History log of /system/extras/simpleperf/cmd_report_test.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3035e41eb6d6e6dc89520aada7f74dc874c14a56 13-Sep-2017 Yabin Cui <yabinc@google.com> simpleperf: Omit dwarf-callgraph tests running on arm translation tools.

Bug: http://b/64946809
Bug: 64709603 (presubmit balking at the line above)
Test: run arm CtsSimpleperfTestCases32 on fugu.
Change-Id: I76ee44b8fd2a6022cbef32392ee0336fe4d14ade
(cherry picked from commit 64a9ecda2c006f90dcc047ad95be792139622ead)
/system/extras/simpleperf/cmd_report_test.cpp
d18c42e6732c7d920373f326e49b4860259afa7f 12-Jul-2017 Yabin Cui <yabinc@google.com> simpleperf: enforce support of dwarf based callgraph.

If it is not supported by the kernel, it may be because
a kernel patch "perf: Fix arch_perf_out_copy_user default",
or a configuration HAVE_PERF_USER_STACK_DUMP is missing.

Bug: http://b/63634097
Test: run simpleperf_unit_tests.
Change-Id: I4d3b2de72925c3566bcb0ebe41872919b7312687
/system/extras/simpleperf/cmd_report_test.cpp
dcb2a3e580f155bb28621c4cbad019d104e8f300 19-May-2017 Yabin Cui <yabinc@google.com> simpleperf: enable two options by default.

Enable dumping symbols in record cmd by default,
and change --dump-symbols option into --no-dump-symbols option.
Show brief call graph in report cmd by default,
and change --brief-callgraph option into --full-callgraph option.
Make the change because these two behaviors are always recommended.

Bug: None.
Test: run simpleperf_unit_test.
Change-Id: Icff6a843a7f46c56313500f4da119aa5118a57e5
/system/extras/simpleperf/cmd_report_test.cpp
0c093f3cc0dbced581c9d430e0ed8cd12def61ce 19-Apr-2017 Yabin Cui <yabinc@google.com> simpleperf: add --brief-callgraph option for report cmd.

Remove duplicated callgraphs (which appears as a sub graph in
another place) in --brief-callgraph mode.
Accept brief callgraph in report.py.
Add unit test for --brief-callgraph option.

Bug: http://b/37444055
Test: run simpleperf_unit_test.
Test: manually run report.py.
Change-Id: I41977762552ec66807f394558352da6cbefaec2e
/system/extras/simpleperf/cmd_report_test.cpp
10dbaaa7263682e5100616cc630b4fbba31fb6fc 24-Feb-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "simpleperf: generate one report for each event attr."
afe99a53d3030f54fa843af3e1558852a4cb3815 24-Feb-2017 Yabin Cui <yabinc@google.com> simpleperf: add --raw-period option for report cmd.

Bug: http://b/35475170
Test: run simpleperf_unit_test.
Change-Id: Ib5bae0b775ac2a3e647b7724df01ce0b8deb1a38
/system/extras/simpleperf/cmd_report_test.cpp
ada97db3d4336faac601663e8bb4b59835ae49a0 24-Feb-2017 Yabin Cui <yabinc@google.com> simpleperf: generate one report for each event attr.

Bug: http://b/35475170
Test: run simpleperf_unit_test.
Test: run report.py.
Change-Id: Ie9329a64c701bce38f7b440c16cb47e99e83db45
/system/extras/simpleperf/cmd_report_test.cpp
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/cmd_report_test.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/cmd_report_test.cpp
044861ba8d71688940b6500f68458fae0791517c 14-Dec-2016 Yabin Cui <yabinc@google.com> simpleperf: check invalid perf.data.

Bug: http://b/33558210
Test: run simpleperf_unit_test.
Change-Id: If5a1f7fc9c436a39776f80f1e52479f1cd7ff407
/system/extras/simpleperf/cmd_report_test.cpp
18385c4b52c25f14475645172a2ce5dfd3fb1e9a 09-Dec-2016 Yabin Cui <yabinc@google.com> simpleperf: Improve Callgraph.

1. Reduce columns used by callgraph by reducing spaces between
entries from 11 to 4. This helps to show more entries in the limited screen width.
2. Add [hit-in-function] line for each entry, so we know the percentage
of samples hit in the function and samples hit in the children functions.
3. Add --kallsyms option for report command.

After all, The callgraph is changed like below.
Before change:
|--99.08%-- java.lang.Thread.run
| void com.example.cyb.tappydefender.TDView.run()
| |
| | |--95.63%-- void com.example.cyb.tappydefender.TDView.draw()

After change:
|--98.85%-- java.lang.Thread.run
| void com.example.cyb.tappydefender.TDView.run()
| |--0.09%-- [hit in function]
| |
| |--95.54%-- void com.example.cyb.tappydefender.TDView.draw()

Bug: http://b/33356538
Test: run simpleperf_unit_test.
Test: run simpleperf report -g manually.
Change-Id: Ifc1846d4ee7469cadbcc727cae6bf59552d919d5
/system/extras/simpleperf/cmd_report_test.cpp
5be914df7e842a052219a6ef4891ff3208373fc3 30-Nov-2016 Yabin Cui <yabinc@google.com> simpleperf: fix tests for dwarf callgraph unwinding.

32-bit simpleperf can't unwind a 64-bit `sleep` process in aarch64
environment. It makes following error in tests:
simpleperf is built in arch arm, and can't do stack unwinding for arch arm64

So make the workload be able to start a process
running callback function. By profiling that process, we can
guarantee that 32-bit simpleperf is profiling a 32-bit process.

Also fix a flaky test IOEventLoop.signal.
Build 32-bit simpleperf_unit_test on 64-bit devices.

Bug: http://b/33167911
Test: run simpleperf_unit_test.
Change-Id: I82741dc5d90c73c1890f834d8e2a9188421a3828
/system/extras/simpleperf/cmd_report_test.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/cmd_report_test.cpp
c0565bb21e2997d7a01dda40ea2b16e067e7e28c 30-Sep-2016 Yabin Cui <yabinc@google.com> Simpleperf: add --max-stack and --percent-limit options for report cmd.

Bug: http://b/24905115
Test: run simpleperf-unit-test.

Change-Id: I177f618f923f90069c0380063f0c3f93427dedd7
/system/extras/simpleperf/cmd_report_test.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/cmd_report_test.cpp
eafa7188ac41584555d36ac0c19f3c7fc66d42cc 30-Aug-2016 Yabin Cui <yabinc@google.com> simpleperf: fix two errors.

Fix two errors when reporting perf.data generated by linux perf.
And add corresponding tests.

Test: run simpleperf_unit_test.
Change-Id: I04dd88461fdd6a85763847570bac16db1ccb81fa
/system/extras/simpleperf/cmd_report_test.cpp
861f655538b17ed37cf5d9bcadc71f22d3a0a6e9 08-Aug-2016 Yabin Cui <yabinc@google.com> simpleperf: fix --pids option.

--pids option was recognized as --tids because of logic
error. this patch fixes that and adds corresponding test.

Bug: http://b/30736228
Change-Id: I0515fc7e03f29f821f7b0aa32c608cf250e87662
Test: run simpleperf_unit_test.
/system/extras/simpleperf/cmd_report_test.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/cmd_report_test.cpp
a2b490908d03d77d3f385e86b24c929555bb79d5 28-Jul-2016 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy performance warnings in simpleperf.

* Use const reference type for parameters to avoid unnecessary copy.
* Use faster overloaded string find function.

Bug: 30407689
Bug: 30411878
Change-Id: I2dac3ab1928fd51fe03c4d7889f17f3b165918f3
Test: build with WITH_TIDY=1
/system/extras/simpleperf/cmd_report_test.cpp
8a599d7c95f2a8207fb3fe90e824aab1f30abe62 22-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: add --duration for stat/record command.

Also fix a bug in ReportCommandTest.callgraph_option.

Bug: http://b/30292111
Change-Id: I21ced0c8aa7ec10c60c4fc1ddc6e5dfd256feeb1
Test: run simpleperf_unit_test.
/system/extras/simpleperf/cmd_report_test.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/cmd_report_test.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/cmd_report_test.cpp
05ef2eab98caee49b6b27cac518856b7f5124bee 11-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: change the separator of --symbols option from comma to semicolon.

Function name of c++ can have comma, like func2(int, int). So it is not
proper to use comma to separate function names.

Bug: 29826956
Change-Id: I9da4bc178232dad53abdc5735358f3feb608fee4
Test: run simpleperf_unit_test.
/system/extras/simpleperf/cmd_report_test.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/cmd_report_test.cpp
f79fbd127178ef1bdca82926fde09cb3ec7ba584 06-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: add symbol filter for report command.

By adding --symbols option, we can report for selected functions.
It helps to filter out functions we don't care, especially when
we are using `simpleperf report --sort vaddr_in_file` to profile
inside a function.

Bug: 29826956

Change-Id: I4de9dfe1a376db097f6163aa780a079cbc33689a
/system/extras/simpleperf/cmd_report_test.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/cmd_report_test.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/cmd_report_test.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/cmd_report_test.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/cmd_report_test.cpp
2d6efe4b167da4e6b77f168b1820239ee65599e2 02-Apr-2016 Yabin Cui <yabinc@google.com> simpleperf: support reporting more than one event type.

When sampling kernel trace points, it is like to sample more than
one even type. Like `simpleperf record -e kmem:mm_page_alloc,kmem:mm_page_free`.

1. change record command to dump event_id for all records.
2. change report command and record reader to support multiple
event attrs.
3. hide record_cache inside EventSelectionSet.
4. add test to report multiple event types.

Bug: 27403614
Change-Id: Ic22a5527d68e7a843e3cf95e85381f8ad6bcb196
/system/extras/simpleperf/cmd_report_test.cpp
8f680f60dc800bec880c5c35bfbc1ac36165e1f3 19-Mar-2016 Yabin Cui <yabinc@google.com> Simpleperf: add test for reporting callgraph of shared libraries in apk file.

Also add comment for how to generate each perf.data in testdata/.
Add --log <leve> argument in unit test to help debugging.

Bug: 26962895
Change-Id: Iaa5a81cd8da5174d5b5b4e7847811e2432bf0db8
/system/extras/simpleperf/cmd_report_test.cpp
05400539d15c50a52a388daba2e831b86824cc8e 18-Mar-2016 Yabin Cui <yabinc@google.com> Simpleperf: support reading symbols from .gnu_debugdata.

As in https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html,
elf files can store mini debug information in .gnu_debugdata.

Bug: 27744639

Change-Id: If4a53a4a1332824388ee309ac63a008dc5cf8d5c
/system/extras/simpleperf/cmd_report_test.cpp
19e6b6d372a1244189dc2df62313085a61ed1a80 10-Mar-2016 Yabin Cui <yabinc@google.com> simpleperf: check if dwarf callgraph is supported by kernel before testing.

Move inclusion of poll.h from header files to source files,
as event_selection_set.h is used by cmd_report_test.cpp, which
can be built on windows.

Bug: 27590546
Change-Id: Ic6b141a93d96610f911ab52da1d927b7f619ccb2
/system/extras/simpleperf/cmd_report_test.cpp
6e51bef9aa101307523946df301ca90215d0ee82 24-Feb-2016 Yabin Cui <yabinc@google.com> simpleperf: port cmd_report_test to nonlinux.

And fix one build_id bug introduced by previous patch.

Bug: 26962895

Change-Id: Ibb8bd6ec77ee862bb01c26342d3b3024468e75b2
/system/extras/simpleperf/cmd_report_test.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/cmd_report_test.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/cmd_report_test.cpp
38e573ee1958959253ba8f3af7567adb4cbeea55 06-Aug-2015 Yabin Cui <yabinc@google.com> Simpleperf: add filters to report command.

Change-Id: I0e6cec1ce638fd4c832fe398a08168138e22ee7e
/system/extras/simpleperf/cmd_report_test.cpp
c42867e0c65569906002e7cdc87161a972b292b7 05-Aug-2015 Yabin Cui <yabinc@google.com> Simpleperf: support caller callgraph.

Bug: 22229391
Change-Id: I95af71d50811feb4515a5c4ec7102788a00aad31
/system/extras/simpleperf/cmd_report_test.cpp
76769e502d8f0ebf5d2c81b00246727fb0a59925 13-Jul-2015 Yabin Cui <yabinc@google.com> Simpleperf: Support dwarf callgraph recording.

1. add OS_RELEASE and ARCH feature in perf.data. ARCH feature is used when parsing
recorded user registers.
2. support `--call-graph dwarf` option in record command.

Bug: 22229391
Change-Id: I56dbdd101338658ce6a9b59aa8be90e712e007f5
/system/extras/simpleperf/cmd_report_test.cpp
ecb9a302b52b034610efb85bd73cb473e7c4ddb2 01-Jul-2015 Yabin Cui <yabinc@google.com> Simpleperf: support callgraph option in report command.

Bug: 19483574
Change-Id: I7c5558a71ea15650c1d3e7afa268b3fbc11543d7
/system/extras/simpleperf/cmd_report_test.cpp
36c662b538bd89e591b1bfcbce59fc0de3602bf6 30-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: support --children option in report command.

1. Refactor code about managing report items.
2. support --children option. It is a preparation to support -g option.

Bug: 19483574
Change-Id: Iba4dc0895c48a9fa1937aed165d7b3a2dc8e5c71
/system/extras/simpleperf/cmd_report_test.cpp
8a530e3bae0cc031d60e397c347e96f44487e919 24-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: add option to report branch stack information.

Bug: 19483574
Change-Id: If98e6d3e7a171bb4f2aa7f5d4be43586a6286f56
/system/extras/simpleperf/cmd_report_test.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/cmd_report_test.cpp
2672dea3f1112b13678103023011c797ca283bac 21-May-2015 Yabin Cui <yabinc@google.com> Add simpleperf report command.

Only support report of process/file level. Symbol parsing is not included.

Bug: 19483574
Change-Id: I6d1c67000bd0e303623183912ff06fdeeb51c5e9
/system/extras/simpleperf/cmd_report_test.cpp