History log of /system/extras/simpleperf/thread_tree.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
52190a377feeb1dccaae5034c51f0130c24dea09 02-Jun-2017 Yabin Cui <yabinc@google.com> simpleperf: add thread name in report_sample.proto.

Bug: http://b/62189080
Test: run simpleperf_unit_test.
Change-Id: I3c96f6474e56b2f51a00f85082973e5d1c1aec72
/system/extras/simpleperf/thread_tree.cpp
63a1c3d83a68e9d94f37b71afe76d0769d744448 19-May-2017 Yabin Cui <yabinc@google.com> simpleperf: support [vdso].

Before this CL, there is no way to parse symbols from [vdso] or unwind
through it. In this CL, simpleperf dumps [vdso] segment in its own memory space
to local file system, so it can be used for getting symbols or unwinding.
It takes care that vdso files for 32bit version and 64bit version are not
misused.

Bug: None.
Test: run simpleperf_unit_test.
Test: run simpleperf on processes using vdso.

Change-Id: I9233daf1d07df262a4a0fcdeadd3e544f3ccc906
/system/extras/simpleperf/thread_tree.cpp
98c7584c1c6cb93ad3e0f66e2a6f1d6b2d8fb878 28-Apr-2017 Yabin Cui <yabinc@google.com> simpleperf: fix unknown binary in samples.

1. Wrong ip addresses in callchain can map to unknown binary. They
should be omitted.
2. When unknown binary is really hitted in samples, which is unlikely
to happen, make sure report-sample cmd will not skip the file id of
unknown binary.
3. Add corresponding test.

Bug: http://b/37783312
Test: run simpleperf_unit_test.
Change-Id: Ifb5b59401bce9c8f81042015e73f190acd43ce31
/system/extras/simpleperf/thread_tree.cpp
aa0dd19abe684059d0595f343395183b864157d2 15-Dec-2016 Yabin Cui <yabinc@google.com> simpleperf: use per process maps.

Originally we use per thread maps, and copy the maps from parent thread
when processing ForkRecord. But there are situations that ForkRecords
are lost, then the new thread is left having no maps, which leads to unknown
dso/symbols.
To fix this, we can use per process maps. Even if ForkRecords are lost,
we know which process a SampleRecord belongs to, and can use the process maps.
This is reasonable because in most cases, new threads in the same thread group
are created with both CLONE_THREAD and CLONE_VM.

Bug: http://b/33503165
Test: run simpleperf_unit_test.
Change-Id: If84b6cdac39cd6ad4e441ed6d75ed879b86d1830
/system/extras/simpleperf/thread_tree.cpp
b2465ad8bae68531dd9dbed88be469612cd7229a 17-Oct-2016 Daniel Friederich <dfriederich@magicleap.com> Support to use kallsyms

Also:
- Adapt to use with Python 3
(where str is a wide type but our C API's expect 8 bit character strings)
- Use OS specific so names (e.g. simpleperf_report.dll on Windows)
- On Windows as we use mingw to build, preload libwinpthread-1.dll.

Test: with manual incovation using report_sample.py
Change-Id: Id973c463608c520b8eec229026c74dc5e8144cf8
/system/extras/simpleperf/thread_tree.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/thread_tree.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/thread_tree.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/thread_tree.cpp
003b245939bae5e86ed53b3c6b333637dbc571b4 30-Sep-2016 Yabin Cui <yabinc@google.com> Simpleperf: don't expose EventSelection.

And some tiny improvements.

Bug: http://b/30974760
Test: run simpleperf_unit_test.
Change-Id: Ie2d46c8ab9ee763d107527c9a54590f845569da4
/system/extras/simpleperf/thread_tree.cpp
190a848fb2d4f502372b2528c55ca1f520e90609 04-Aug-2016 Yabin Cui <yabinc@google.com> simpleperf: keep binary in class Record.

It removes memory copy and heap allocation/deallocation in
Record::BinaryFormat(), and is a preparation to remove memory
copy and heap allocation in Record constructor.

Bug: 30649868
Test: run simpleperf_unit_test.
Change-Id: Ic8dd80e43f7b547a9beaf896d726b56aeb5d55a2
/system/extras/simpleperf/thread_tree.cpp
71b533b5a2902c75901c9e3fc9da3befd53e54dc 21-Jul-2016 Yabin Cui <yabinc@google.com> simplperf: improve unknown symbol print in report-sample command.

Add * for all unknown symbols, so it is easier to write program to
identify unknown symbols.
Use dso[+ip_offset] for unknown symbols.

Bug: 28114205
Change-Id: I14cfffe6673a9aedc62cc288c1b2d724ab411f5d
/system/extras/simpleperf/thread_tree.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/thread_tree.cpp
c855ecc6becfe5d1c2445094aa525856e4538f7c 12-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: add min_vaddr in DsoRecord.

Min virtual address of a shared library is needed when mapping ip
addresses to function symbols. So we should dump it in DsoRecord.

Bug: 28114205
Test: run simpleperf_unit_test.

Change-Id: Ib986ee598281cf60caa3a2c5408100b9e7678143
/system/extras/simpleperf/thread_tree.cpp
9970a2344333f2c19d9126cfec4f833f50ff2f22 29-Jun-2016 Yabin Cui <yabinc@google.com> Simpleperf: add vaddr_in_file sort key in report command.

Currently report command can't report more details than function name.
After adding vaddr_in_file sort key, it can report the place of the
instruction being sampled. vaddr_in_file is the instruction's virtual
address in elf file, which matches output generated by objdump.

Bug: 29826956
Test: run simpleperf_unit_test.
Change-Id: Ifad4dfb7c60014a03c01ffbfd0b972858f1a4884
/system/extras/simpleperf/thread_tree.cpp
1761a271faf98050891ba6e918993225782c811a 24-Jun-2016 Yabin Cui <yabinc@google.com> Simpleperf: Add SPLIT and SPLIT_END records to handle big records.

Previously we split KernelSymbolRecord because it is > 65535. Then
I found TracingDataRecord can also be > 65535. So it is better to
handle big records when reading and writing perf.data.
record_file_writer.cpp splits a big record into multiple SPLIT
records followed by a SPLIT_END record, and record_file_reader.cpp
restores the big record when reading SPLIT and SPLIT_END records.
Also Add RecordHeader to represent record having size > 65535.

Bug: 29581559
Change-Id: I0b4556988f77b3431c7f1a28fce65cf225d6a067
Test: run simpleperf_unit_test.
/system/extras/simpleperf/thread_tree.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/thread_tree.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/thread_tree.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/thread_tree.cpp
b64a86327afe2b77dab7d724d363386c674163b6 25-May-2016 Yabin Cui <yabinc@google.com> simpleperf: refactor SampleTree for reuse.

By moving most function in report command into template classes, it
allows other report commands to reuse the code.

Bug: 27403614
Change-Id: I3d35b3a34d48c5c043ba4257a52eaf0961c12bca
/system/extras/simpleperf/thread_tree.cpp
040f7b4c62ce49f0af0746640e94d415764262cd 14-Apr-2016 Yabin Cui <yabinc@google.com> simpleperf: use libbacktrace_offline static library.

Device may not have libbacktrace_offline shared library, so always
using libbacktrace_offline static library.
Use simpleperf namespace to avoid conflicts with ThreadEntry in
libbacktrace.

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

Change-Id: Ic15d4778c7accd1382de0b440a437aba2cf67016
/system/extras/simpleperf/thread_tree.cpp
b7f481f59126456b0e708a76f40fa88224f3531b 24-Oct-2015 Yabin Cui <yabinc@google.com> Simpleperf: Don't load whole perf.data into memory.

perf.data can be too large to be loaded into memory.
To avoid this, use fread() instead of mmap() to read perf.data,
and always use RecordCache to sort records.

Fix unit tests failure caused by previous change.

Bug: 25194400

Change-Id: If29dc0bb0ed992ba34202c2cb1a204a1d9123b7a
/system/extras/simpleperf/thread_tree.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/thread_tree.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/thread_tree.cpp
f8258896a364b6c996b6d6816b88849cc8d0a488 03-Aug-2015 Yabin Cui <yabinc@google.com> Simpleperf: fix the process of parsing records.

It is not correct to parse all the mmap records first, then parse
all the sample records. Instead, records should be parsed one by one.
This change also fix the bug of not writing kernel build id in
record command, which is introduced previously.

Change-Id: I7e6d3d1c74c134e4b7af97c184b6a71c3379a59a
/system/extras/simpleperf/thread_tree.cpp
5f2a170a577258a2792bd768a8a776a562f4e6c2 24-Jul-2015 Yabin Cui <yabinc@google.com> Simpleperf: work around unexpected (pid, tid) pair.

Bug: 22185053
Change-Id: Ibd224ce9918eac9fa5a71ec00835b3af2b03e578
/system/extras/simpleperf/thread_tree.cpp
73d8078e6e5ef92b2301386ce96260bd99efacbb 24-Jul-2015 Yabin Cui <yabinc@google.com> Simpleperf: use ThreadTree when getting hit files in record command.

The new method is more accurate and has lower time complexity.

Bug: 22229391
Change-Id: I8b3016798b8a0e20335adeb7ec5dda0068044142
/system/extras/simpleperf/thread_tree.cpp
60a0ea96c0fb9e807c899759256df5e20bd904bd 23-Jul-2015 Yabin Cui <yabinc@google.com> Simpleperf: separate ThreadTree from SampleTree.

It is a preparation for unwinding in record command.

Bug: 22229391
Change-Id: I2f5c6df3f7332d4c98b61c7f9f922456b5bbeaaa
/system/extras/simpleperf/thread_tree.cpp