History log of /system/extras/simpleperf/environment.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0720d488b902fa5ddea20813dfaf34e942218c48 07-Mar-2017 Yabin Cui <yabinc@google.com> simpleperf: adjust sample_freq based on max_sample_rate file.

Starting from kernel 4.4, perf_event_max_sample_rate can be
adjusted dynamically by the kernel to limit the cpu percentage
used to dump records.

Bug: http://b/35554543
Test: echo 100 >/proc/sys/kernel/perf_event_max_sample_rate &&
Test: run CtsSimpleperfTestCases
Change-Id: I75f6cbc124c545d05fd56b07c6a868b7ca15cd8a
/system/extras/simpleperf/environment.h
b92bae84b27889b548214bee8d0730ef10da0c6d 10-Feb-2017 Yabin Cui <yabinc@google.com> simpleperf: build libsimpleperf_inplace_sampler library.

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
/system/extras/simpleperf/environment.h
5f43fc4ac870b49542b4cf530a3729f9f1e0e9ab 13-Dec-2016 Yabin Cui <yabinc@google.com> simpleperf: check monitored targets regularly.

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
/system/extras/simpleperf/environment.h
417df291499b37f63fa9b930e081d80a25bf38ec 16-Nov-2016 Yabin Cui <yabinc@google.com> simpleperf: fix dumping arm regs on arm64 devices.

On arm64 devices, the kernel dumps arm64 regs
even for 32-bit processes. So we need to map
from arm64 registers to arm registers.

Bug: http://b/30974693
Test: run simpleperf manually on one app.
Change-Id: Iffeac9510b418b5dabc0604c16523887d63bba49
/system/extras/simpleperf/environment.h
0a7a06d2fef05f497497219bf922a5db1980707e 28-Oct-2016 Yabin Cui <yabinc@google.com> simpleperf: avoid errors/warnings caused by sepolicy.

If running in an app user id, sepolicy doesn't allow reading
many /proc and /sys files, like /proc/<pid> belonging to
other users, /sys/kernel/notes, /proc/sys/kernel/perf_event_paranoid,
/proc/sys/kernel/kptr_restrict.
With this patch, simpleperf doesn't read /proc/<pid> belonging to
other users, and doesn't report error/warning when failing to read
/proc/sys/* files.

Bug: http://b/32460013
Test: run `simpleperf record` in an app user id.
Test: run simpleperf_unit_test.
Test: run simpleperf runtest.py.
Change-Id: I6618fbd10a9112637c8e501ec76628c9ec4ccaa7
/system/extras/simpleperf/environment.h
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/environment.h
3eee0055078d1868301d52a33f6e54a5bd79d0da 03-Sep-2016 Treehugger Robot <treehugger-gerrit@google.com> Merge "Use android::base::GetExecutablePath in simpleperf."
f30c96ff34a131a1c163aae746f7bb13e225371b 02-Sep-2016 Elliott Hughes <enh@google.com> Use android::base::GetExecutablePath in simpleperf.

Bug: http://b/30988271
Change-Id: Ide5f1696834cfa1081e86131e24499bd15131cd6
/system/extras/simpleperf/environment.h
bc2a1022e1ea0a8c17691594d39fa53021de9166 29-Aug-2016 Yabin Cui <yabinc@google.com> simpleperf: handle monitored processes correctly when a cpu is up.

For stat/record cmd, the way to handle -p option is to change the
process list into a thread list before profiling. However, it doesn't
work well if we want to open new event files when a cpu is up. The
situation in problem is as below:

1. Monitor for process A, which currently has thread a.
2. Then we open event files for thread a.
3. Process A creates thread b. If profiling child threads/processes
is enabled, the kernel will monitor thread b automatically.
4. A new cpu is up, and we need to open new event files on that
cpu. But we will only open event file for thread a, although the
user command is to monitor the whole process.

To fix this, remember which processes are monitored in
EventSelectionSet, and search threads in the monitored processes
each time to open new event files.

Bug: http://b/29245608
Test: run simpleperf record cmd and make cpu offline and online.
Test: run simpleperf_unit_test.
Change-Id: Iabf9e30be9f0bc5a3651227e4695034c0b9e0258
/system/extras/simpleperf/environment.h
af69895fec14e33be1ac0af31d62ca87844a89b3 08-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: check kernel symbol addresses before dumping them.

If kernel symbols have zero addresses, there is no need to dump them,
and we can give useful suggestion.

Bug: 29574526
Test: manually set /proc/sys/kernel/kptr_restrict and run simpleperf record.
Change-Id: I850531c7e4c5315a44e08cf3b73852e77fef8eb8
/system/extras/simpleperf/environment.h
b891549ed16a91b6db52e8500bb6816fc9293bac 22-Jun-2016 Yabin Cui <yabinc@google.com> Simpleperf: check if -f option for record command is in valid range.

Read /proc/sys/kernel/perf_event_max_sample_rate to get max
valid sample frequency.

Bug: 29574526
Change-Id: I269fefc87a7561bb15f41c3b4a494e7604e005fb
Test: Run `simpleperf record -f 10000000`, check the error message.
/system/extras/simpleperf/environment.h
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/environment.h
ebf79f3a65c81ef0f8cd7a3b875771be88157fcc 02-Jun-2016 Yabin Cui <yabinc@google.com> simpleperf: check perf event limit.

The property security.perf_harden is added in https://android-review.googlesource.com/#/c/233736/5. And simpleperf needs to notice that.

Bug: 29054680
Change-Id: I5f1593f5b389d182a56c4bf3bd438a1dc2b66686
/system/extras/simpleperf/environment.h
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/environment.h
7134f388ccdccb4a5e3025254002a85333a72a70 26-Mar-2016 Yabin Cui <yabinc@google.com> simpleperf: don't looking for _text symbol in /proc/kallsyms.

simpleperf looks for _text symbol in /proc/kallsyms to get
kernel address space information. But that info is no longer
needed. As some kernels don't have _text symbol, we should
remove the corresponding code.

Bug: 27814103
Change-Id: I4eb9869b58c51846c99b1204f304cd107a0eb354
/system/extras/simpleperf/environment.h
cb4c17ea53269ced994a2d849cbafb1afd5296e1 27-Oct-2015 Yabin Cui <yabinc@google.com> simpleperf: support --cpu option in record/stat command.

--cpu option is used to record on selected cpus.

Change-Id: If5bb9b42a064d2ff69fbeec77906fc79943dddc1
/system/extras/simpleperf/environment.h
918e4b757aa5e8a04811039068e2b56528505e28 12-Aug-2015 Dan Albert <danalbert@google.com> Add missing includes for pid_t.

Was being transitively included through libc++, but the libc++ update
fixes some of the leaky headers (used to always include unistd.h!).

Change-Id: I40caf74695bb75901bda24665b8d83a6914de9c4
/system/extras/simpleperf/environment.h
be6afa300a01ad1e6cb493e748d709d0b3b5e3b5 25-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: don't use designation in struct member initialization.

designation is not supported in c++ standard, and partially initialized
struct can be unsafe.
And use constexpr when desired.

Bug: 19483574
Change-Id: I4f445845a7d97aeb685f02176485c70f8b0ca995
/system/extras/simpleperf/environment.h
d713f959ec1fe07ed993e2c9f4166b52aa98a58c 24-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: support cmdline feature in perf.data.

Bug: 19483574
Change-Id: I92f16d6616f274f31ea54e305fe1de10049baf02
/system/extras/simpleperf/environment.h
41d4ba9f6f2781155a0519a784606d5382cda88f 22-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: better support for per thread comm.

1. Move ProcessEntry to ThreadEntry, and add thread_comm in SampleEntry.
2. Add support of ForkRecord and Mmap2Record.
3. Dump ForkRecord for each thread in record command.
4. Add sort key 'tid' in report command, and change default keys.

Bug: 19483574
Change-Id: Iacc690637154aeb7b6f85373730beb50d638ce86
/system/extras/simpleperf/environment.h
b032de7a9e1975a838cd6df2e7c8df3c7f70a3ce 18-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: support monitoring existing processes/threads.

Also change the default record freq from 1000 to 4000. Because 1000 seems to be too low.

Bug: 19483574
Change-Id: I340fcb9d28a156862705e483ee340a1c824eea21
/system/extras/simpleperf/environment.h
f569b478e74560a2d9e29a96824e16b93a55b97f 30-Apr-2015 Yabin Cui <yabinc@google.com> Support tracepoint event types in simpleperf.

Also support options in `simpleperf list`, add test about tracepoint event types.

Bug: 19483574

Change-Id: I2d2c2f300fe5e2968696228899084410aa9f29a4
/system/extras/simpleperf/environment.h
8f6225147c5b6cb2159a7f5cb0dab952ee0759df 06-May-2015 Yabin Cui <yabinc@google.com> Dump build_id feature in `simpleperf record`.

Bug: 19483574
Change-Id: Ie2acd8a157bca9ad3c01a2e4b37e139aba89670f
/system/extras/simpleperf/environment.h
7d59bb49fb47fbc82ef5c77d7aebf7174fd996e1 05-May-2015 Yabin Cui <yabinc@google.com> Dump kernel/modules/thread mmap information in `simpleperf record`.

Bug: 19483574
Change-Id: Ia65cb12804a6dffa440501736a6229b2f7248958
/system/extras/simpleperf/environment.h
9759e1b1ce76185aa539aeea2fb1cbd8382156e7 29-Apr-2015 Yabin Cui <yabinc@google.com> Implement simpleperf record/dumprecord subcommands.

Bug: 19483574

Change-Id: Id879713a75c2d3a6289d8847b95ee0bb4a2cc8a0
/system/extras/simpleperf/environment.h
323e945313b190373b3fcfe578e25ee8390a76d3 21-Apr-2015 Yabin Cui <yabinc@google.com> Implement simpleperf stat subcommand.

Also add some simple unit-tests.

Change-Id: Ic30a2d4a879e028a8c82babbaf82e322fc49a838
/system/extras/simpleperf/environment.h