You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
..
app_api
demo
doc
include
nonlinux_support
runtest
rust
scripts
simpleperf_app_runner
testdata
.clang-format
.gitignore
Android.bp
Android.mk
CallChainJoiner.cpp
CallChainJoiner.h
CallChainJoiner_test.cpp
CtsSimpleperfTestCases_testdata
ETMBranchListFile.cpp
ETMBranchListFile.h
ETMBranchListFile_test.cpp
ETMConstants.h
ETMDecoder.cpp
ETMDecoder.h
ETMRecorder.cpp
ETMRecorder.h
IOEventLoop.cpp
IOEventLoop.h
IOEventLoop_test.cpp
JITDebugReader.cpp
JITDebugReader.h
JITDebugReader_impl.h
JITDebugReader_test.cpp
MapRecordReader.cpp
MapRecordReader.h
MapRecordReader_test.cpp
NOTICE
OWNERS
OfflineUnwinder.cpp
OfflineUnwinder.h
OfflineUnwinder_impl.h
OfflineUnwinder_test.cpp
ProbeEvents.cpp
ProbeEvents.h
ProbeEvents_test.cpp
README.md
RecordFilter.cpp
RecordFilter.h
RecordFilter_test.cpp
RecordReadThread.cpp
RecordReadThread.h
RecordReadThread_test.cpp
RegEx.cpp
RegEx.h
RegEx_test.cpp
SampleComparator.h
SampleDisplayer.h
TEST_MAPPING
build_id.h
callchain.h
cmd_api.cpp
cmd_api_impl.h
cmd_api_test.cpp
cmd_boot_record.cpp
cmd_boot_record_test.cpp
cmd_debug_unwind.cpp
cmd_debug_unwind_test.cpp
cmd_dumprecord.cpp
cmd_dumprecord_test.cpp
cmd_help.cpp
cmd_inject.cpp
cmd_inject_test.cpp
cmd_kmem.cpp
cmd_kmem_test.cpp
cmd_list.cpp
cmd_list_test.cpp
cmd_merge.cpp
cmd_merge_test.cpp
cmd_monitor.cpp
cmd_monitor_test.cpp
cmd_record.cpp
cmd_record_impl.h
cmd_record_test.cpp
cmd_report.cpp
cmd_report_sample.cpp
cmd_report_sample.proto
cmd_report_sample_test.cpp
cmd_report_test.cpp
cmd_stat.cpp
cmd_stat_impl.h
cmd_stat_test.cpp
cmd_trace_sched.cpp
cmd_trace_sched_test.cpp
command.cpp
command.h
command_test.cpp
cpu_hotplug_test.cpp
dso.cpp
dso.h
dso_test.cpp
environment.cpp
environment.h
environment_test.cpp
etm_branch_list.proto
event_attr.cpp
event_attr.h
event_fd.cpp
event_fd.h
event_selection_set.cpp
event_selection_set.h
event_type.cpp
event_type.h
event_type_table.h
generate_event_type_table.py
get_test_data.h
gtest_main.cpp
kallsyms.cpp
kallsyms.h
kallsyms_test.cpp
libsimpleperf_report_fuzzer.cpp
main.cpp
perf_event.h
perf_regs.cpp
perf_regs.h
perf_regs_test.cpp
profcollect.cpp
read_apk.cpp
read_apk.h
read_apk_test.cpp
read_dex_file.cpp
read_dex_file.h
read_dex_file_test.cpp
read_elf.cpp
read_elf.h
read_elf_test.cpp
read_symbol_map.cpp
read_symbol_map.h
read_symbol_map_test.cpp
record.cpp
record.h
record_equal_test.h
record_file.h
record_file.proto
record_file_format.h
record_file_reader.cpp
record_file_test.cpp
record_file_writer.cpp
record_lib_interface.cpp
record_lib_test.cpp
record_test.cpp
report_lib_interface.cpp
report_utils.cpp
report_utils.h
report_utils_test.cpp
sample_tree.h
sample_tree_test.cpp
simpleperf.rc
test_util.cpp
test_util.h
thread_tree.cpp
thread_tree.h
thread_tree_test.cpp
tracing.cpp
tracing.h
tracing_test.cpp
utils.cpp
utils.h
utils_test.cpp
workload.cpp
workload.h
workload_test.cpp

README.md

Simpleperf

Android Studio includes a graphical front end to Simpleperf, documented in Inspect CPU activity with CPU Profiler. Most users will prefer to use that instead of using Simpleperf directly.

If you prefer to use the command line, Simpleperf is a versatile command-line CPU profiling tool included in the NDK for Mac, Linux, and Windows.

This file contains documentation for simpleperf maintainers.

There is also user documentation.

Building new prebuilts

To snap the aosp-simpleperf-release branch to ToT AOSP main and kick off a build, use this coastguard page and choose "aosp-simpleperf-release" from the "Branch" dropdown. Then click "Submit build requests". You'll get emails keeping you up to date with the progress of the snap and the build.

Updating the prebuilts

Once you have the build id (a 7-digit number) and the build is complete, run the update script from within the system/extras/simpleperf directory:

$ ./scripts/update.py --build 1234567

This will create a new change that you can repo upload, then approve and submit as normal.

For testing, I usually only run python host tests as below:

$ ./scripts/test/test.py --only-host-test

To test all scripts, please use python 3.8+ and install below packages:

$ pip install bokeh jinja2 pandas protobuf textable

Updating the prebuilts in prebuilts/simpleperf

Download ndk branch.

$ repo init -u persistent-https://android.git.corp.google.com/platform/manifest -b master-ndk
$ repo sync

In prebuilts/simpleperf, run update.py:

$ ./update.py --build <bid>

Then manually edit ChangeLog. This will create a new change that you can repo upload, then approve and submit as normal.

For testing, we need to test if the scripts run on darwin/linux/windows for different android versions. I usually split it to four parts:

  1. Test on android emulators running on linux x86_64 host, for android version N/O/P/Q/R/S/current.
$ ./test/test.py -d <devices> -r 3

The scripts support android >= N. But it's easier to test old versions on emulators. So I only test android N on emulators.

Currently, the tests have problems in clean up. So tests on emulator may fail and take too long to run. And there are a few known failed cases. Hopefully they will be fixed soon.

  1. Test on android devices connected to linux x86_64 host, for android version O/P/Q/R/S/current.
$ ./test/test.py -d <devices> -r 3
  1. Test on an android device connected to darwin x86_64 host, for one of android version O/P/Q/R/S/current.
$ ./test/test.py -d <devices> -r 1
  1. Test on an android device connected to darwin x86_64 host, for one of android version O/P/Q/R/S/current.
$ ./test/test.py -d <devices> -r 1

To check simpleperf contents released in ndk, we can build ndk package.

$ <top_dir>/ndk/checkbuild.py --package --system linux --module simpleperf

The ndk package is generated in out/ directory.