Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(976)

Unified Diff: tools/ll_prof.py

Issue 1469153004: Add support for PERF_RECORD_MMAP2 record type (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add support for MMAP2 record type Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ll_prof.py
diff --git a/tools/ll_prof.py b/tools/ll_prof.py
index f9bea4a61f2fc561f6f98070a840b7673f47e281..7dac2e05eba77e1925b0fa76cb532d9914bb296e 100755
--- a/tools/ll_prof.py
+++ b/tools/ll_prof.py
@@ -568,7 +568,7 @@ PERF_EVENT_HEADER_DESC = Descriptor([
])
-# Reference: kernel/events/core.c
+# Reference: kernel/tools/perf/util/event.h
PERF_MMAP_EVENT_BODY_DESC = Descriptor([
("pid", "u32"),
("tid", "u32"),
@@ -577,6 +577,20 @@ PERF_MMAP_EVENT_BODY_DESC = Descriptor([
("pgoff", "u64")
])
+# Reference: kernel/tools/perf/util/event.h
+PERF_MMAP2_EVENT_BODY_DESC = Descriptor([
+ ("pid", "u32"),
+ ("tid", "u32"),
+ ("addr", "u64"),
+ ("len", "u64"),
+ ("pgoff", "u64"),
+ ("maj", "u32"),
+ ("min", "u32"),
+ ("ino", "u64"),
+ ("ino_generation", "u64"),
+ ("prot", "u32"),
+ ("flags","u32")
+])
# perf_event_attr.sample_type bits control the set of
# perf_sample_event fields.
@@ -616,6 +630,7 @@ PERF_SAMPLE_EVENT_IP_FORMAT = "u64"
PERF_RECORD_MMAP = 1
+PERF_RECORD_MMAP2 = 10
PERF_RECORD_SAMPLE = 9
@@ -664,6 +679,15 @@ class TraceReader(object):
mmap_info.filename = HOST_ROOT + filename[:filename.find(chr(0))]
return mmap_info
+ def ReadMmap2(self, header, offset):
+ mmap_info = PERF_MMAP2_EVENT_BODY_DESC.Read(self.trace,
+ offset + self.header_size)
+ # Read null-terminated filename.
+ filename = self.trace[offset + self.header_size + ctypes.sizeof(mmap_info):
+ offset + header.size]
+ mmap_info.filename = HOST_ROOT + filename[:filename.find(chr(0))]
+ return mmap_info
+
def ReadSample(self, header, offset):
sample = self.sample_event_body_desc.Read(self.trace,
offset + self.header_size)
@@ -973,6 +997,14 @@ if __name__ == "__main__":
else:
library_repo.Load(mmap_info, code_map, options)
mmap_time += time.time() - start
+ elif header.type == PERF_RECORD_MMAP2:
+ start = time.time()
+ mmap_info = trace_reader.ReadMmap2(header, offset)
+ if mmap_info.filename == HOST_ROOT + V8_GC_FAKE_MMAP:
+ log_reader.ReadUpToGC()
+ else:
+ library_repo.Load(mmap_info, code_map, options)
+ mmap_time += time.time() - start
elif header.type == PERF_RECORD_SAMPLE:
ticks += 1
start = time.time()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698