diff options
author | Yabin Cui <yabinc@google.com> | 2018-07-16 14:04:49 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2018-07-16 17:46:11 -0700 |
commit | 2db05b4b3d209ae184ecb9dccb1d7925c3357abd (patch) | |
tree | ac6f31c2b507d7c342a6aa4e978770bcac52b425 /simpleperf/record.cpp | |
parent | 2ce2fa7eed139891406e4a5662a5481c3a376b54 (diff) | |
download | extras-2db05b4b3d209ae184ecb9dccb1d7925c3357abd.tar.gz |
simpleperf: prefer to use mmap2 records instead of mmap records.
When doing system wide recording, simpleperf spents a lot of time
in calling ApkInspector::FindElfInApkByOffset() in
UpdateMmapRecordForEmbeddedPath() in cmd_record.cpp (about 35%
main thread time). This is because app processes map many files
in the apk into the memory.
Actually we only need to change the maps of executable files in the
apk. However, mmap record doesn't show whether the mapped file is
executable. So switch to mmap2 record when possible. mmap2 record is
supported starting from kernel 3.16, and dumps more info than mmap
record, like the protect flag of the map. After switching to mmap2
records, the cost of calling ApkInspector::FindElfInApkByOffset()
is decreased to about 1% main thread time.
Also switch to dump mmap and comm records only for the first event
type.
Also avoid using IsRegularFile() in IsMappingOnlyExistInMemory, which
saves about 3% main thread time.
Also add a test to request mmap2 record support in Q.
Bug: none
Test: run simpleperf for system wide recording manually.
Test: run simpleperf_unit_test.
Change-Id: Ib0f42f509cb10b3242503d54d048f9c90885affa
Diffstat (limited to 'simpleperf/record.cpp')
-rw-r--r-- | simpleperf/record.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/simpleperf/record.cpp b/simpleperf/record.cpp index 60ade898..ab2ef72a 100644 --- a/simpleperf/record.cpp +++ b/simpleperf/record.cpp @@ -306,7 +306,7 @@ void Mmap2Record::DumpData(size_t indent) const { ", ino_generation %" PRIu64 "\n", data->pgoff, data->maj, data->min, data->ino, data->ino_generation); - PrintIndented(indent, "prot %u, flags %u, filenames %s\n", data->prot, + PrintIndented(indent, "prot %u, flags %u, filename %s\n", data->prot, data->flags, filename); } |