History log of /system/extras/simpleperf/dso.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f560a6fdf092f0c03c0e7a92d62948d34318146a 15-Dec-2016 Yabin Cui <yabinc@google.com> simpleperf: build cts test running in app context.

When built for cts test, the test binary uses run-as to move itself
to the data directory of debuggable app 'com.android.simpleperf',
and run the tests in app context using run-as.

Bug: http://b/18790309
Test: run cts-tradefed, 'run everything -m CtsSimpleperfTestCase'.
Change-Id: I523470bb8062cb944b44dc6f264a8b1c14221b62
/system/extras/simpleperf/dso.cpp
a939245000a86f6749b10f007e3b5a38d61f67c7 13-Jan-2017 Yabin Cui <yabinc@google.com> simpleperf: fix dumpping kernel symbols.

Fix the bug that `simpleperf record --dump-symbols` doesn't dump
kernel symbols.

Test: run simpleperf_unit_test.
Change-Id: I55a2b7c5cd40395b61b062064834779a6a44a29e
/system/extras/simpleperf/dso.cpp
e2f1078c54cc4bd81e45b5ca3c88ed0fdfd8cbc7 15-Dec-2016 Yabin Cui <yabinc@google.com> simpleperf: merge dumped symbols with symbols read from file system.

Bug: http://b/32340274
Test: run simpleperf_unit_test.
Change-Id: Icb96d4778cf527720b24aed58699da05b29c1bd4
/system/extras/simpleperf/dso.cpp
52c6369cd3bc5dfb5f05b4e3b2c66aec47065c04 29-Nov-2016 Yabin Cui <yabinc@google.com> simpleperf: add stuff in report_lib_interface.

It's a preparation to annotate binaries, containing following
changes:
1. Export build_id for binaries.
2. Export function virtual addresses.
3. Add unit tests in simpleperf_report_lib.py.

Bug: http://b/32834638
Test: simpleperf_unit_test.
Test: run `python simpleperf_report_lib.py`.
Change-Id: Ieed40935ff9ede44bf823ba9c88ad87806ffac0a
/system/extras/simpleperf/dso.cpp
aba7e29f163b4a332a9d3fe9973d82c7d0db148f 11-Nov-2016 Yabin Cui <yabinc@google.com> simpleperf: dump only needed symbols in file feature section.

Instead of dumping all symbols in the hit elf files, dump only
needed symbols can save a lot of space. To do so, read perf.data
after recording to collect hit file and symbol information.

Bug: http://b/32340274
Test: test using `simpleperf record --dump-symbols` manually.
Test: run simpleperf_unit_test.
Change-Id: I480f3e2e7ccebfbb5df16a597724f5f40d62c821
/system/extras/simpleperf/dso.cpp
16501ffbd73483c498dde1ea4ad2670da7c9df55 20-Oct-2016 Yabin Cui <yabinc@google.com> simpleperf: use file records in protobuf output.

Dump file name and symbol name for each CallChainEntry
takes too much space. So instead we store file_id and
symbol_id for each CallChainEntry, and store file
records separately.

In CallChainEntry, replace ip with vaddr_in_file, because
vaddr_in_file is more useful in finding instructions in
elf file.

Bug: http://b/32210800
Test: simpleperf_unit_test.
Change-Id: I85542db21acbaa4d81b3c3aa7f9215f2d23c4878
/system/extras/simpleperf/dso.cpp
c5b4a3106a0845d1bd8fd2c1b1c724eeb719ec62 24-Oct-2016 Yabin Cui <yabinc@google.com> simpleperf: dump file feature section.

For `record --dump-symbols` option, change from dumping
DsoRecord and SymbolRecord to dumping file feature section.
It is to avoid reading symbols from elf files during recording,
which takes a lot of time. And we don't want to mix optional
data (the symbol tables) with necessary data (the profiling records).

Bug: http://b/32340274
Test: run simpleperf_unit_test.
Test: run simpleperf runtest.py.

Change-Id: I0a387de243afac93486fc885f223a58060ec07f4
/system/extras/simpleperf/dso.cpp
78fddd140931adf704061f82e3c9fcb03362f8d0 24-Oct-2016 Yabin Cui <yabinc@google.com> simpleperf: use Dso::IsHit() to mark hit binaries.

Bug: http://b/32340274
Test: simpleperf_unit_test.
Change-Id: I074973cdc0420d28c7dfcaca80e477234bceec95
/system/extras/simpleperf/dso.cpp
2597ef042881f834d1bc414930f144a405dd13ca 19-Oct-2016 Yabin Cui <yabinc@google.com> simpleperf: support building sample record manually.

And other small changes:
add time when building comm record.
move some Move*BinaryFormat to utils.h.
Handle wrong symbol whoes address can be ULLONG_MAX.

Bug: http://b/30974760
Test: simpleperf_unit_test.
Change-Id: I2956d3c4b781c580fe93a6e5b77e0469f7f4f43f
/system/extras/simpleperf/dso.cpp
cb6c901e01739ec10942556b6171029b1117c772 25-Aug-2016 Yabin Cui <yabinc@google.com> simpleperf: print file path used for reading symbols.

It helps users to find out which files are used for
reporting.

Bug: http://b/29574526
Change-Id: I3d608e61c50471632c50bf6e8f6f9e45c63fc4b4
Test: run `simpleperf report --log verbose` manually.
/system/extras/simpleperf/dso.cpp
078658638c01c035ebcb98a557628101566a1d57 22-Aug-2016 Yabin Cui <yabinc@google.com> simpleperf: avoid selinux denials.

1. Don't stat() entries in /proc directory if not necessary.
2. Don't read tracing events in debugfs if not root.

Bug: http://b/30981595
Change-Id: Ic695671357dad936d60f4e6d573ce4452dec217c
Test: run `simpleperf list` and check kmsg.
/system/extras/simpleperf/dso.cpp
dec43c18d06415a955b8f32355bca925be901905 30-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: print warning message when failed to read symbol table from elf file.

Change return type of read elf functions to ElfStatus, and print warning message
based on situation.
Add corresponding test.

Bug: 29193936
Change-Id: Ie449f8be34cb579962cb73f4be3df9e4997270ca
Test: run simpleperf_unit_test.
/system/extras/simpleperf/dso.cpp
15475e6ff1bc0273f666ef1bd6c2f7a50c4b948c 14-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: show dso[+vaddr_in_file] for unknown symbols.

It gives more information than just unknown symbols.
Add --no-show-ip option to disable this additional detail.

Bug: 29772268
Change-Id: Ie8067f95b5fdc65806044e229ee12095367d115a
Test: run simpleperf_unit_test.
/system/extras/simpleperf/dso.cpp
eec606cfefcb8cb20ac0f9e3465daff09fb31ffd 07-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: fix build id check of files in symfs.

In dso.cpp, build_id_map_ should use path_ instead of GetAccessiblePath() as the key.
However, patch https://android-review.googlesource.com/#/c/175654/ wrongly used
GetAccessiblePath() as the key in build_id_map_. This patch fixes the error and add
corresponding test.

Check if file in symfs exists before using it as debug file path.
If the build id of debug file path doesn't match the one in build_id_map_, output
warning to user.

Bug: 28911532
Test: run simpleperf_unit_test.
Change-Id: I21bca508359a492245db4cba5d287005363cd465
/system/extras/simpleperf/dso.cpp
6965d42c43f12fd2dfcca3c490b51edc67822586 15-Jun-2016 Yabin Cui <yabinc@google.com> simpleperf: add kmem command to report slab allocation information.

Bug: 27403614

Change-Id: Id3015a4828ec32170ea1db3a1580b14a8bd159ba
/system/extras/simpleperf/dso.cpp
767dd17947f1ae9dd3d02f738d442a23ed76f2f6 03-Jun-2016 Yabin Cui <yabinc@google.com> simpleperf: add report-sample command.

1. Add report-sample command to report each sample with symbol information.
2. Add --dump-symbols option to record command to collect dso and symbol
information in perf.data.

Bug: 28114205

Change-Id: I37424ee6abd74a21ad41cd3b6c4249cf0625c201
/system/extras/simpleperf/dso.cpp
b42129797f17f990ea5a88c6bdc7446000cc361c 25-May-2016 Yabin Cui <yabinc@google.com> simpleperf: record kernel symbols in perf.data.

To better support kernel profiling, record kernel symbols in perf.data
when necessary. An option --no-dump-kernel-symbols is added in
record command to always avoid recording kernel symbols.
The way to handle all zero /proc/modules and /proc/kallsyms is
improved. Add Better support in finding symbols for kernel modules.

Bug: 27403614
Change-Id: I470151c54f8a45ad1c101c1b94490e33d7fd7485
/system/extras/simpleperf/dso.cpp
7d6c8abc4bdc48ff44db83103f274d9b0bcecc87 16-Apr-2016 Chih-Hung Hsieh <chh@google.com> Fix some google-runtime-int warnings.

Bug: 28220065
Change-Id: Ic6b24216d216bbb165a1420b52b11c7703b810a0
/system/extras/simpleperf/dso.cpp
b1a885b014540a2f7798b5a35ea0f0ec150d93ee 15-Feb-2016 Yabin Cui <yabinc@google.com> simpleperf: report symbols of native libraries in apk file.

Changes included:
1. provide interface in read_apk.h to read build id and symbols.
2. report symbols of native libraries in apk file.
3. refactor code in read_elf.cpp and read_apk.cpp.
4. add verbose log.
5. add -o report_file_name option for report command.
6. add corresponding unit tests.

Bug: 26962895
Change-Id: I0d5398996e0c29dba4a6f5226692b758ca096bbd
/system/extras/simpleperf/dso.cpp
66dd09e8e2407082ce93bf0784de641298131912 04-Dec-2015 Elliott Hughes <enh@google.com> Track rename from base/ to android-base/.

Change-Id: Ic15d4778c7accd1382de0b440a437aba2cf67016
/system/extras/simpleperf/dso.cpp
547c60e4dd29c5788d5948ad348acf33a55d6ed6 13-Oct-2015 Yabin Cui <yabinc@google.com> Simpleperf: fix some unknown symbols for report result.

Using debug shared libraries in /usr/lib/debug on linux host.
Match ip addresses with symbols by symbols' virtual addresses instead of
file offsets in elf file. Because symbols' file offsets in debug shared
libraries are different from those in original shared libraries.

Fix overlapped maps.

Bug: 24716851
Change-Id: I9cb64958c4de5c7a6c77c3febc5f689cf2df650f
/system/extras/simpleperf/dso.cpp
8a52e97bfd6e2c59ef48fedb277168a7bfbeec46 01-Oct-2015 Yabin Cui <yabinc@google.com> Simpleperf: warn if it can't read kernel symbols addresses.

And a little format adjustment.

Bug: 24404256
Change-Id: Ie8dcd37138a693df18101d415e6e3243f4963582
/system/extras/simpleperf/dso.cpp
3c8c21345478816dd0c70c096090b564c91bd9d2 14-Aug-2015 Yabin Cui <yabinc@google.com> Simpleperf: support dwarf callgraph in report command.

Use libbacktrace for stack unwinding.

Bug: 22229391
Change-Id: Iab35cdb52936c65c4728e23423ded83050f1db76
/system/extras/simpleperf/dso.cpp
cc2e59e2478d330c89eaceda0dcc1f05ee32fbf8 21-Aug-2015 Yabin Cui <yabinc@google.com> Simpleperf: use OneTimeFreeAllocator to allocate symbol names.

simpleperf report takes a lot of time mallocing and freeing memory.
This change reduces the time to free memory.

Before this change:
$sudo simpleperf stat simpleperf report
Performance counter statistics:

3,258,481,203 cpu-cycles # 2.290946 GHz (80%)
4,147,660,154 instructions # 0.785619 cycles per instruction (79%)

Total test time: 1.422330 seconds.

After this change:
$sudo simpleperf stat simpleperf report
Performance counter statistics:

1,699,221,386 cpu-cycles # 2.994754 GHz (79%)
2,739,945,156 instructions # 0.620166 cycles per instruction (81%)

Total test time: 0.567399 seconds.

This change also fix a bug in record_file_test.cpp.

Bug: 23387541

Change-Id: I59fc86ca54a6c09bd08eec8ada931ccff88d3102
/system/extras/simpleperf/dso.cpp
c84856093e8bf4350d30fc521dc0f1c800c5270b 21-Aug-2015 Yabin Cui <yabinc@google.com> Simpleperf: refactor dso.

Having DsoEntry and DsoFactory confuses me which part code should belong to.
This change merges the two into class Dso and makes things clear.
It is also a preparation for performance optimization in Dso.

Bug: 23387541
Change-Id: I41e773406a7f1582a11a18859df252ce8ea3acfa
/system/extras/simpleperf/dso.cpp
b10a8fb990f71351558ed07b84b57ad5cafe993a 19-Aug-2015 Yabin Cui <yabinc@google.com> Simpleperf: demangle symbols only when necessary.

Before this change:
$sudo simpleperf record -a sleep 1
$sudo simpleperf stat simpleperf report
Total test time: 4.088779 seconds.

After this change:
$sudo simpleperf record -a sleep 1
$sudo simpleperf stat simpleperf report
Total test time: 1.226267 seconds.

Change-Id: Ifc811f432ac69f770eeb5814e4983f6f19dbc909
/system/extras/simpleperf/dso.cpp
04c70a62b68c1a0c0f79392f335463a7ee044ba6 04-Aug-2015 Yabin Cui <yabinc@google.com> Simpleperf: don't check for empty build id.

Change-Id: I670ba4fa32aa764e49022abacd83ef1fdcfa7d0d
/system/extras/simpleperf/dso.cpp
ba50c4bba1c3ea7e98a475a3d2ae2e6c24ee81f2 21-Jul-2015 Yabin Cui <yabinc@google.com> Simpleperf: load symbols from dso file only when necessary.

Bug: 22630113
Change-Id: I12bb24ec02ba3ddb94bcb2a26ae2d6e7b445ed4d
/system/extras/simpleperf/dso.cpp
39d3caeb60a913276a2bbaa35f6a28dc3284eb52 14-Jul-2015 Yabin Cui <yabinc@google.com> Simpleperf: support --vmlinux option in report command.

Bug: 22179177
Change-Id: I633da55c6bfcb106d69de9bda6b44bce24ffca8e
/system/extras/simpleperf/dso.cpp
638c558339b7f1ae0ed95f64bcf7dbc5b238ed83 02-Jul-2015 Yabin Cui <yabinc@google.com> Simpleperf: check build id in report command.

1. refactor BuildId type.
2. check build id before parsing symbols in report command.

Bug: 22179177

Change-Id: Iefc797a88d4a168e109db786105120c8d6914369
/system/extras/simpleperf/dso.cpp
9fd3cc1048a3d0338df4a48760dfd655560992a1 26-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: support build on mac.

Bug: 19483574
Change-Id: I6c28541944bc0a4e6fc07d7ea5a8fb5f71890510
/system/extras/simpleperf/dso.cpp
2c17e0db003baeb044bf3e13175f5d00c414c3fc 11-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: parse prefixed symbol of linker.

Bug: 19483574
Change-Id: I2597d4a91fd9a6cfc5c15c8b637dc4ba5213ee56
/system/extras/simpleperf/dso.cpp
b378355f34b2b585eaf2be262bcd9baae9f3d36a 11-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: improve symbol parsing.

Support c++ symbol demangling, and add option to disable it.
Add option to set symfs dir, so it can report on host.
Add label symbols, add add symbol length fixing for it.
Add two hacks about arm elf symbol parsing.

Bug: 19483574

Change-Id: I300d6c007c8634db382d0a50627b9cde1502df89
/system/extras/simpleperf/dso.cpp
ec12ed9010128483993a87d68edc02d3a89d56cf 08-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: support symbol parsing in report command.

Also fix the storage of ProcessEntry.

Bug: 19483574
Change-Id: I2182a804f6ecbd28e7aa3c1a38a6f19b86f583c9
/system/extras/simpleperf/dso.cpp