summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_stat_test.cpp
AgeCommit message (Collapse)Author
2017-07-14simpleperf: change the way running cts tests.Yabin Cui
Before this CL, CtsSimpleperfTestCases copies itself to the app's directory, then run it using run-as. With this CL, CtsSimpleperfTestCases keeps itself in /data/local/tmp, but forces stat/record cmd to run with --app option. This gives more freedom to tests: 1. They can stay in shell's context with --in-app option. 2. The stat/record cmds are started in the shell's context, so they can collect information no available in app's context (like data in /sys/kernel/debug/tracing/events). This is a preparation to add tests for recording tracepoint events. It also matches the way we want users to use simpleperf (with --app option). Bug: http://b/29520177 Test: run CtsSimpleperfTestCases. Change-Id: I1709adfb1ff7169df87560226c197e473fdf8516
2017-02-10simpleperf: build libsimpleperf_inplace_sampler library.Yabin Cui
libsimpleperf_inplace_sampler.so is a library linked with user's app. It opens a unix socket server and waits for simpleperf's profiling request. This patch doesn't contain code generating real samples, instead it uses a fake sample for testing. Add runtest for 32bit. Increase runtest duration to 2 seconds and adjust some args in runtest.conf to make test result stable. Fix one tiny error in cmd_report.cpp to report correctly in `report --sort comm,symbol`. Bug: http://b/30974760 Test: run simpleperf_unit_test. Test: run runtest.py. Change-Id: I58163fe47f62e6ba7dd684b33a2ce302feb880f5
2016-12-13simpleperf: check monitored targets regularly.Yabin Cui
When monitoring some threads/processes not forked by simpleperf, check if these threads/processes exist regularly. So we can stop profiling once all threads/processes exit. Also handle SIGHUP signal, so we can finish profiling properly when `adb shell simpleperf record xxx` is killed by Ctrl-C. Add corresponding tests. Bug: http://b/33558210 Test: run simpleperf_unit_test. Change-Id: Ieae4d00d099dc1c7a0c51b0610dff43981bb642e
2016-11-29simpleperf: fix tests for dwarf callgraph unwinding.Yabin Cui
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
2016-09-29simpleperf: add interval to stat printWei Wang
Add a stat interval printing Bug: http://b/31806433 Test: simpleperf_unit_test --gtest_filter=stat_cmd.interval_option Change-Id: Ia2881d990036cc099baccb8a2d8cd3828877a910 (cherry picked from commit e6d8a52400fe710b743ce57b89bd015ab219434b)
2016-08-24Merge "simpleperf: notify user for unsupported modifiers."Yabin Cui
am: 43908a31c1 Change-Id: I4f53fa84ea663a4090a99f2261f153faf8f0b8fb
2016-08-24simpleperf: notify user for unsupported modifiers.Yabin Cui
If there is no need to record samples, u/k modifiers used in event cpu-clock and task-clock are ignored by the kernel. Bug: http://b/29574526 Change-Id: Id45568448888965a3bfa382c4420e395a741f77a Test: simpleperf_unit_test.
2016-08-05Merge "simpleperf: allow --duration option when executing child command."Yabin Cui
am: 4b97e8e71f Change-Id: I98f11a1fa3bab4c1754e76fc0d82b39a5225205b
2016-08-05simpleperf: allow --duration option when executing child command.Yabin Cui
Previously --duration option can't be used while executing child command, mainly because we use `sleep XX` child command to implement --duration option. By using libevent, the limit doesn't exist. Bug: http://b/30405638 Change-Id: Iea1953ecf3aca48e75fb74f048ed04ad5b168630 Test: run simpleperf_unit_test.
2016-08-05Merge "simpleperf: remove cpu option tests."Yabin Cui
am: 9ec492a979 Change-Id: I9ed4fc32a7ba7030c48d4d5b7d7a905caed01e6d
2016-08-05simpleperf: remove cpu option tests.Yabin Cui
The cpu option tests are flaky because Cpu 0 can be offlined. Bug: http://b/30389972 Change-Id: Ie9f57dcde957be245167c957eb029ab37496471e Test: run simpleperf cts test.
2016-07-27Merge \"simpleperf: use libevent in stat command.\"Yabin Cui
am: cab924fae5 Change-Id: Id3f2e39a1aebddcdc6e548595b394d4eedcf3e0f
2016-07-27simpleperf: use libevent in stat command.Yabin Cui
Wrap libevent in IOEventLoop, use IOEventLoop in stat command. Add corresponding tests. Bug: http://b/30405638 Change-Id: I78b79e0eff1365ab46dde29c2a24a2def586af79 Test: run simpleperf_unit_test.
2016-07-22Merge \"simpleperf: add --duration for stat/record command.\"Yabin Cui
am: 53fdddd794 Change-Id: Ibc911eb9be4666dae97ae179248863a0622541a8
2016-07-22simpleperf: add --duration for stat/record command.Yabin Cui
Also fix a bug in ReportCommandTest.callgraph_option. Bug: http://b/30292111 Change-Id: I21ced0c8aa7ec10c60c4fc1ddc6e5dfd256feeb1 Test: run simpleperf_unit_test.
2016-07-07Merge \"Simpleperf: add auto generated summaries in stat command.\"Yabin Cui
am: 11615de832 Change-Id: I41e95398507e62f442d948273c12cb65e5d1730d
2016-07-06Simpleperf: add auto generated summaries in stat command.Yabin Cui
When there are summaries monitoring one event type in user space and kernel space at the same time period, we can automatically generate a summary combining the results generated in user space and kernel space. This can help to decrease the number of needed hardware counters. Also adjust scale check when deciding whether an event is monitored all the time. Bug: 29213742 Change-Id: I272e21420700c10fccb1336a1e60138db8d13b3d Test: run simpleperf_unit_test.
2016-06-27resolve merge conflicts of a486a4b to nyc-dev-plus-aospYabin Cui
Change-Id: Iad2f0b498d7abd2eb52116a32517bfee20129f05
2016-06-27Simpleperf: fix flaky tests.nougat-devYabin Cui
Simpleperf stat/record command may need 1 second to set security.perf_harden property. So the monitored child threads should run longer than 1 second. Bug: 29763505 Change-Id: I9bf6dcba03f3fc5c91130f38a08ce0062e104103
2016-06-17simpleperf: support event group.Yabin Cui
Kernel supports monitoring several events as a group, so they are scheduled on and out at the same time. Add --group option to stat command and record command. Adjust the method to calculate miss rate in stat command: limit the matched events in the same group or with scale == 1.0. Bug: 29213742 Change-Id: I899aba207f1e3357307541e81f97526f5a2913c3
2016-04-01simpleperf: loosen unwinding arch check for system wide collection.Yabin Cui
When doing system wide collection, it is possible that there are 32-bit compat processes running on 64-bit devices. It is not proper to abort in this situation. So loosen the check to allow it. Also add corresponding test. Bug: 27927427 Change-Id: I5c9253eb6e474497e4f37e234e0e523e141fab20
2016-03-07simpleperf: support building cts test.Yabin Cui
1. build cts test libraries. 2. change tests to use tmpfile instead of perf.data. 3. support extracting testdata from cts test file. Bug: 27387280 Change-Id: I7c5db77f3157d586d0c9beb446b247626e7cce36 (cherry picked from commit be7ec66eaa4f995bd9068637f7c7d5718173922c)
2016-03-07simpleperf: report symbols of native libraries in apk file.Yabin Cui
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 (cherry picked from commit b1a885b014540a2f7798b5a35ea0f0ec150d93ee)
2016-03-02simpleperf: support building cts test.Yabin Cui
1. build cts test libraries. 2. change tests to use tmpfile instead of perf.data. 3. support extracting testdata from cts test file. Bug: 27387280 Change-Id: I7c5db77f3157d586d0c9beb446b247626e7cce36
2016-02-17simpleperf: report symbols of native libraries in apk file.Yabin Cui
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
2015-12-04Track rename from base/ to android-base/.Elliott Hughes
Change-Id: Ic15d4778c7accd1382de0b440a437aba2cf67016
2015-10-30simpleperf: support --cpu option in record/stat command.Yabin Cui
--cpu option is used to record on selected cpus. Change-Id: If5bb9b42a064d2ff69fbeec77906fc79943dddc1
2015-06-19Simpleperf: support event type modifier.Yabin Cui
Also fix a bug in event_attr dumping. Bug: 19483574 Change-Id: I255647d1471acab3a63c3dc787ab06b3d2bee294
2015-06-18Simpleperf: support monitoring existing processes/threads.Yabin Cui
Also change the default record freq from 1000 to 4000. Because 1000 seems to be too low. Bug: 19483574 Change-Id: I340fcb9d28a156862705e483ee340a1c824eea21
2015-06-04Simpleperf: refactor command system.Yabin Cui
Register a callback function to create a new command instance instead of registering a command instance. Then we can release resources in the command destructors, and don't need xxxCommandImpl classes any more. Bug: 19483574 Change-Id: Ibb54892ec0655fd43909347afd72bb08bc8a716c
2015-05-15Support tracepoint event types in simpleperf.Yabin Cui
Also support options in `simpleperf list`, add test about tracepoint event types. Bug: 19483574 Change-Id: I2d2c2f300fe5e2968696228899084410aa9f29a4
2015-05-05Dump kernel/modules/thread mmap information in `simpleperf record`.Yabin Cui
Bug: 19483574 Change-Id: Ia65cb12804a6dffa440501736a6229b2f7248958
2015-05-04Implement simpleperf record/dumprecord subcommands.Yabin Cui
Bug: 19483574 Change-Id: Id879713a75c2d3a6289d8847b95ee0bb4a2cc8a0
2015-04-23Implement simpleperf stat subcommand.Yabin Cui
Also add some simple unit-tests. Change-Id: Ic30a2d4a879e028a8c82babbaf82e322fc49a838