diff options
author | Yabin Cui <yabinc@google.com> | 2018-03-20 15:29:03 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2018-03-21 11:25:08 -0700 |
commit | cdc11a390138765046c8d730708b86c63aa3c488 (patch) | |
tree | 922d8d40634818769985fff131605ae35fbf6c26 /simpleperf/thread_tree.h | |
parent | dd4f07b1396db2b95d9dddad03b743eaca462c53 (diff) | |
download | extras-cdc11a390138765046c8d730708b86c63aa3c488.tar.gz |
simpleperf: support profiling jited java code.
1. For each jit symfile, generate a Mmap2Record with a special flag
PROT_JIT_SYMFILE_MAP.
2. Call ReadMmapEventData() before dumping jit Mmap2Records, to keep
the order of samples and mmap records.
3. Handle finding symbols from maps with PROT_JIT_SYMFILE_MAP flags.
4. Pass PROT_JIT_SYMFILE_MAP flag to libunwindstack, to unwind
through jited methods.
Bug: http://b/73127105
Test: run simpleperf manually.
Test: run simpleperf_unit_test.
Change-Id: I2b2f77ff457f7eb2f10193e987a181e4791a29ee
Diffstat (limited to 'simpleperf/thread_tree.h')
-rw-r--r-- | simpleperf/thread_tree.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/simpleperf/thread_tree.h b/simpleperf/thread_tree.h index a3653f5f..11177027 100644 --- a/simpleperf/thread_tree.h +++ b/simpleperf/thread_tree.h @@ -34,6 +34,10 @@ constexpr char DEFAULT_EXECNAME_FOR_THREAD_MMAP[] = "//anon"; namespace simpleperf { +namespace map_flags { +constexpr uint32_t PROT_JIT_SYMFILE_MAP = 0x4000; +} // namespace map_flags + struct MapEntry { uint64_t start_addr; uint64_t len; @@ -41,15 +45,18 @@ struct MapEntry { uint64_t time; // Map creation time. Dso* dso; bool in_kernel; + uint32_t flags; + MapEntry(uint64_t start_addr, uint64_t len, uint64_t pgoff, uint64_t time, - Dso* dso, bool in_kernel) + Dso* dso, bool in_kernel, uint32_t flags = 0) : start_addr(start_addr), len(len), pgoff(pgoff), time(time), dso(dso), - in_kernel(in_kernel) {} + in_kernel(in_kernel), + flags(flags) {} MapEntry() {} uint64_t get_end_addr() const { return start_addr + len; } @@ -95,7 +102,8 @@ class ThreadTree { void AddKernelMap(uint64_t start_addr, uint64_t len, uint64_t pgoff, uint64_t time, const std::string& filename); void AddThreadMap(int pid, int tid, uint64_t start_addr, uint64_t len, - uint64_t pgoff, uint64_t time, const std::string& filename); + uint64_t pgoff, uint64_t time, const std::string& filename, + uint32_t flags = 0); const MapEntry* FindMap(const ThreadEntry* thread, uint64_t ip, bool in_kernel); // Find map for an ip address when we don't know whether it is in kernel. |