History log of /system/extras/simpleperf/event_fd.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b6b433224c144c46a08e5b118df3ce6501571aec 04-May-2017 Yabin Cui <yabinc@google.com> simpleperf: fix tracing counters.

Previously prev_counter is an uninitialized value, which makes
the tracing result not correct.

Test: run simpleperf/systrace.py to profile an app.
Change-Id: I440771f705e22dec7a2948cb2f1164c17d41259a
/system/extras/simpleperf/event_fd.cpp
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/event_fd.cpp
26968e6c48dea2eaa217991ade5a04e801f1be8f 30-Jan-2017 Yabin Cui <yabinc@google.com> simpleperf: add inplace-sampler event type.

Add inplace-sampler event type, so it can be used in
record/list command. This cl doesn't add code for communicating
with profiled process, and fake records in InplaceSamplerClient.cpp
for testing purpose.
Refactor runtest.py to test inplace-sampler profiling.

Bug: http://b/30974760
Test: run runtest.py --inplace-sampler.
Change-Id: I92d8b03583c58b3589207f5c655e03853899be3a
/system/extras/simpleperf/event_fd.cpp
92f80f45926f658ba9c0ddd03afe8e65d458698a 07-Jan-2017 Yabin Cui <yabinc@google.com> simpleperf: fix synchronization when reading mapped buffer.

Fixed according to http://lxr.free-electrons.com/source/kernel/events/ring_buffer.c#L61.

Test: run simpleperf_unit_test.

Change-Id: I44486b1630c92de57fb575b502b2d7c798e46e4b
/system/extras/simpleperf/event_fd.cpp
2ea6de11962fea5613f15308b202fb505e57ae9b 25-Oct-2016 Yabin Cui <yabinc@google.com> simpleperf: merge records from different buffers in memory.

By reading records from all buffers at once, we can merge records
in memory instead of sorting them in perf.data. To make it clear,
this patch only contains the code to merge records in memory, and
I will remove old method later.

Bug: http://b/32343227
Test: run simpleperf_unit_test.
Test: run simpleperf_runtest.py.
Change-Id: Iea2da06c072243c2014f43c8aa6d96a23cfb9123
/system/extras/simpleperf/event_fd.cpp
cf69e4190b77e3a41344552851714eef8489d448 30-Sep-2016 Wei Wang <wvw@google.com> simpleperf: add perf counter into trace

Bug: http://b/31840600
Test: captured systrace with simpleperf stat
Change-Id: I14447d048ea8d059a377c6f0d7cfc10041a98693
/system/extras/simpleperf/event_fd.cpp
825e56be3a1c5310969aaa3e10a7cd1f63455189 27-Aug-2016 Yabin Cui <yabinc@google.com> simpleperf: support hotplug events in record cmd.

1. When a cpu is down, read records from event files on that cpu,
then close those event files.
2. When a cpu is up, open event files on that cpu, and create
mapped buffer for those event files to dump records.
3. Instead of creating a mapped buffer for each event type on each
cpu, we can just create a mapped buffer for all event types on
each cpu.
4. When new event files are created, store a EventIdRecord record in
perf.data to notify record_file_reader.cpp.

Bug: http://b/29245608
Test: run simpleperf record cmd and make cpu offline and online.
Test: run simpleperf_unit_test.

Change-Id: Ib97a24b6292fa143e9b35cb105bdddf1e826d60a
/system/extras/simpleperf/event_fd.cpp
dbbda3020c483a8da2e9ce985c1e9d8b7bcc8ec0 28-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: use libevent in record command.

Support read Event in IOEventLoop, test it, and use it
in record command.
Format related code and clean up some comments.

Bug: http://b/30405638
Change-Id: I3b07d50b0374be3f3e7ee9fa4d0c0ccc8ae21a2b
Test: run simpleperf_unit_test.
/system/extras/simpleperf/event_fd.cpp
0a072cda021e5dfbdbb39f4d8d30771a851b3c3a 14-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: adjust mapped buffer size in record command.

Instead of fixing the mapped buffer size, we can adjust
it at runtime. So users don't need to adjust -m manually.

Bug: 29574526
Change-Id: Icb580df3d60f8d2cf554c0d4139e6f7f64b19f8f
Test: run simpleperf_unit_test.
/system/extras/simpleperf/event_fd.cpp
6173592d3d086b8e493590d626fdbdb4e344c433 08-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: combine mapped buffer used for the same event and cpu.

Non root users have a size limit of buffers used for profiling.
By combining buffers used for the same event and cpu, we can
reduce buffer cost when monitoring multiple threads, thus
avoid mmap() failures.

Increase default value for -m option for non system wide profiling.

Bug: 28911532
Change-Id: I91148061eb54840c144cf72e7bb901e7b74897ec
Test: run simpleperf_unit_test.
/system/extras/simpleperf/event_fd.cpp
27816c9bb55b4b818caca815131432ce0eec9ed6 07-Jul-2016 Yabin Cui <yabinc@google.com> simpleperf: give suggestion when mmap fails.

Bug: 29574526
Change-Id: I72cf2d0e1d15a561314d3c043650479b2c6773ff
/system/extras/simpleperf/event_fd.cpp
877751bbae11e009070e036ee1cd16e88135fff5 14-Jun-2016 Yabin Cui <yabinc@google.com> simpleperf: support event group.

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
/system/extras/simpleperf/event_fd.cpp
c10a9dce1f1faa292317c815205d821fd1f859be 15-Jun-2016 Yabin Cui <yabinc@google.com> simpleperf: add type modifier when reporting events.

Before the change:
$simpleperf record -e cpu-cycles:u sleep 1
$simpleperf report
...
Event: cpu-cycles (type 0, config 0)
...

After the change:
$simpleperf report
...
Event: cpu-cycles:u (type 0, config 0)
...

Change-Id: I296c5476e03250e928ed0f579483d6866576d417
/system/extras/simpleperf/event_fd.cpp
5633586f0efc54dbaecad3deeb8568786317832d 18-Apr-2016 Yabin Cui <yabinc@google.com> simpleperf: improve cpu_hotplug tests.

Add cpu hotplug test for ioctl(PERF_EVENT_IOC_ENABLE),
and improve cpu_hotplug tests by removing sleep calls.

Bug: 28384580

Change-Id: I5869cd9bb3086b6f3a73cf7dce4ffd720326c3c6
/system/extras/simpleperf/event_fd.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/event_fd.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/event_fd.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/event_fd.cpp
b9ca50b319d2083c5a92c468e54796b0e71a4ad9 05-Dec-2015 Yabin Cui <yabinc@google.com> Merge "Simpleperf: don't use ioctl(PERF_EVENT_IOC_ENABLE)."
66dd09e8e2407082ce93bf0784de641298131912 04-Dec-2015 Elliott Hughes <enh@google.com> Track rename from base/ to android-base/.

Change-Id: Ic15d4778c7accd1382de0b440a437aba2cf67016
/system/extras/simpleperf/event_fd.cpp
a46794fa2963de93a9d25fd6945d3c58121e2ba6 03-Dec-2015 Yabin Cui <yabinc@google.com> Simpleperf: don't use ioctl(PERF_EVENT_IOC_ENABLE).

Some android kernels(like bullhead/angler) can't handle
ioctl(PERF_EVENT_IOC_ENABLE) correctly when cpu-hotplug
happens. Instead of fixing all of them in kernel, we
can't simply don't use it.

Bug: 25193162
Change-Id: I9df1458045ffd2ccc2c7ba393e746ebba7c253de
/system/extras/simpleperf/event_fd.cpp
f469c3d7f4466a2a31c3e837969c43c1e3bc4c90 08-Oct-2015 Yabin Cui <yabinc@google.com> Simpleperf: do stack unwinding while recording.

Dumping user's stack consumes lots of disk space, which makes long period recording
impossible. This patch does stack unwinding before writing to perf.data, so it doesn't
need to save user's stack. Previous behavior is still supported with --post-unwind option.

A record cache is used for online record processing.

Bug: 22229391
Change-Id: Idcc6ec46924fff3fcc8c165d62f8af875b173cd4
/system/extras/simpleperf/event_fd.cpp
42aa127e8ab4c5eb5197cf3cc68470cf3a0fdcbb 18-Sep-2015 Yabin Cui <yabinc@google.com> Simpleperf: rewrite unsupported logging style.

Previously we can use a ternary operator to choose the log level, like
(error ? LOG(ERROR) : LOG(DEBUG)) << xxx. But as the LOG() macro is about
to change, we can no longer write like this.

This CL also changes some improper log levels and log messages.

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

Bug: 19483574
Change-Id: I6c28541944bc0a4e6fc07d7ea5a8fb5f71890510
/system/extras/simpleperf/event_fd.cpp
d115b2f738f2cef352877b26c2d93460ac9fea25 15-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: support event type modifier.

Also fix a bug in event_attr dumping.

Bug: 19483574
Change-Id: I255647d1471acab3a63c3dc787ab06b3d2bee294
/system/extras/simpleperf/event_fd.cpp
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/event_fd.cpp
7d4904d5fc038f8125cfc63a5eaa4669ee2aebda 09-Jun-2015 Yabin Cui <yabinc@google.com> Simpleperf: fix a few bugs.

Fix mistyped word.
Kill workload process when exiting.
Add checking of whether branch sampling is supported.

Bug: 19483574

Change-Id: Ibe48914cd92da1ee40bf67c0c47a6376a7291e8c
/system/extras/simpleperf/event_fd.cpp
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/event_fd.cpp
9759e1b1ce76185aa539aeea2fb1cbd8382156e7 29-Apr-2015 Yabin Cui <yabinc@google.com> Implement simpleperf record/dumprecord subcommands.

Bug: 19483574

Change-Id: Id879713a75c2d3a6289d8847b95ee0bb4a2cc8a0
/system/extras/simpleperf/event_fd.cpp
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/event_fd.cpp
67d3abd7b26a741347b33402ad32f5c6735ca0bd 17-Apr-2015 Yabin Cui <yabinc@google.com> Implement simpleperf list subcommand.

simpleperf is used to replace linux/tools/perf. And This CL implements
the list subcommand of it.

Change-Id: I3e6fe854e19cc370070d0fd8416d0aa6fa8f8e90
/system/extras/simpleperf/event_fd.cpp