Name Date Size #Lines LOC

..--

CtsSimpleperfTestCases_testdata/H25-Apr-2025-

app_api/H25-Apr-2025-1,274871

demo/H25-Apr-2025-4,8713,983

doc/H25-Apr-2025-33,67232,521

include/H25-Apr-2025-12547

nonlinux_support/H25-Apr-2025-14662

runtest/H25-Apr-2025-1,3151,035

rust/H25-Apr-2025-8137

scripts/H25-Apr-2025-89,65186,308

simpleperf_app_runner/H25-Apr-2025-312248

testdata/H25-Apr-2025-50,84949,337

.clang-formatH A D25-Apr-2025239 1211

.gitignoreH A D25-Apr-20255 11

Android.bpH A D25-Apr-202519 KiB817784

BranchListFile.cppH A D25-Apr-202524.6 KiB743668

BranchListFile.hH A D25-Apr-20258 KiB246179

BranchListFile_test.cppH A D25-Apr-20255.2 KiB164136

CallChainJoiner.cppH A D25-Apr-202513.8 KiB428358

CallChainJoiner.hH A D25-Apr-20255.9 KiB182117

CallChainJoiner_test.cppH A D25-Apr-202510.1 KiB272213

ETMConstants.hH A D25-Apr-20251.2 KiB3312

ETMDecoder.cppH A D25-Apr-202536.8 KiB1,020819

ETMDecoder.hH A D25-Apr-20253.3 KiB9851

ETMRecorder.cppH A D25-Apr-20259 KiB308251

ETMRecorder.hH A D25-Apr-20252.7 KiB9553

IOEventLoop.cppH A D25-Apr-20256.9 KiB232182

IOEventLoop.hH A D25-Apr-20253.7 KiB10950

IOEventLoop_test.cppH A D25-Apr-20258.1 KiB326271

JITDebugReader.cppH A D25-Apr-202529 KiB789655

JITDebugReader.hH A D25-Apr-20259.5 KiB256166

JITDebugReader_impl.hH A D25-Apr-20252.4 KiB9363

JITDebugReader_test.cppH A D25-Apr-20253.9 KiB10164

MapRecordReader.cppH A D25-Apr-20257.1 KiB239197

MapRecordReader.hH A D25-Apr-20252.5 KiB8046

MapRecordReader_test.cppH A D25-Apr-20252.8 KiB9867

NOTICEH A D25-Apr-202510.4 KiB191158

OWNERSH A D25-Apr-202589 43

OfflineUnwinder.cppH A D25-Apr-202515.8 KiB369302

OfflineUnwinder.hH A D25-Apr-20253.1 KiB8953

OfflineUnwinder_impl.hH A D25-Apr-20251.6 KiB5528

OfflineUnwinder_test.cppH A D25-Apr-20253.8 KiB12181

ProbeEvents.cppH A D25-Apr-20255.3 KiB174130

ProbeEvents.hH A D25-Apr-20251.8 KiB5928

ProbeEvents_test.cppH A D25-Apr-20251.8 KiB5326

README.mdH A D25-Apr-20253.1 KiB9970

RecordFilter.cppH A D25-Apr-202516 KiB529446

RecordFilter.hH A D25-Apr-20257.1 KiB142101

RecordFilter_test.cppH A D25-Apr-202511.1 KiB361270

RecordReadThread.cppH A D25-Apr-202524.3 KiB686590

RecordReadThread.hH A D25-Apr-20257.7 KiB222139

RecordReadThread_test.cppH A D25-Apr-202522.1 KiB586496

RegEx.cppH A D25-Apr-20252.6 KiB9058

RegEx.hH A D25-Apr-20251.8 KiB5830

RegEx_test.cppH A D25-Apr-20251.4 KiB5025

SampleComparator.hH A D25-Apr-20254.2 KiB12986

SampleDisplayer.hH A D25-Apr-202510 KiB303245

TEST_MAPPINGH A D25-Apr-202575 77

ZstdUtil.cppH A D25-Apr-20256.6 KiB214168

ZstdUtil.hH A D25-Apr-20251.8 KiB5830

ZstdUtil_test.cppH A D25-Apr-20253.3 KiB8756

branch_list.protoH A D25-Apr-20252.9 KiB10790

build_id.hH A D25-Apr-20253 KiB10866

callchain.hH A D25-Apr-20255.1 KiB158123

cmd_api.cppH A D25-Apr-20259.5 KiB299246

cmd_api_impl.hH A D25-Apr-20251.3 KiB3514

cmd_api_test.cppH A D25-Apr-20253 KiB11070

cmd_boot_record.cppH A D25-Apr-20256 KiB193152

cmd_boot_record_test.cppH A D25-Apr-20251.5 KiB4318

cmd_debug_unwind.cppH A D25-Apr-202527.2 KiB738641

cmd_debug_unwind_test.cppH A D25-Apr-20257.7 KiB193137

cmd_dumprecord.cppH A D25-Apr-202521.3 KiB628554

cmd_dumprecord_test.cppH A D25-Apr-20253.3 KiB9857

cmd_help.cppH A D25-Apr-20252.9 KiB9764

cmd_inject.cppH A D25-Apr-202547.9 KiB1,3471,162

cmd_inject_test.cppH A D25-Apr-202514.2 KiB373265

cmd_kmem.cppH A D25-Apr-202525.9 KiB699615

cmd_kmem_test.cppH A D25-Apr-20254.7 KiB152110

cmd_list.cppH A D25-Apr-202514.5 KiB461385

cmd_list_test.cppH A D25-Apr-20251.5 KiB5927

cmd_merge.cppH A D25-Apr-202514.6 KiB430364

cmd_merge_test.cppH A D25-Apr-20253.2 KiB9558

cmd_monitor.cppH A D25-Apr-202521.9 KiB615502

cmd_monitor_test.cppH A D25-Apr-20254.1 KiB150102

cmd_record.cppH A D25-Apr-202591 KiB2,3972,052

cmd_record_impl.hH A D25-Apr-20256.8 KiB11389

cmd_record_test.cppH A D25-Apr-202552.9 KiB1,5001,185

cmd_report.cppH A D25-Apr-202541 KiB1,067934

cmd_report_sample.cppH A D25-Apr-202538.7 KiB1,014900

cmd_report_sample.protoH A D25-Apr-20256.1 KiB165141

cmd_report_sample_test.cppH A D25-Apr-202513.6 KiB326234

cmd_report_test.cppH A D25-Apr-202525.7 KiB749597

cmd_stat.cppH A D25-Apr-202536.9 KiB1,011885

cmd_stat_impl.hH A D25-Apr-202512.4 KiB340273

cmd_stat_test.cppH A D25-Apr-202524.7 KiB720566

cmd_trace_sched.cppH A D25-Apr-202514.9 KiB426373

cmd_trace_sched_test.cppH A D25-Apr-20252.1 KiB6639

command.cppH A D25-Apr-20259.9 KiB302254

command.hH A D25-Apr-20257.9 KiB242187

command_test.cppH A D25-Apr-20259 KiB215163

cpu_hotplug_test.cppH A D25-Apr-202515.7 KiB504422

dso.cppH A D25-Apr-202536 KiB1,122934

dso.hH A D25-Apr-20258.4 KiB243164

dso_test.cppH A D25-Apr-202516.8 KiB426321

environment.cppH A D25-Apr-202537.2 KiB1,185996

environment.hH A D25-Apr-20255.1 KiB184129

environment_test.cppH A D25-Apr-20255.2 KiB164117

event_attr.cppH A D25-Apr-202510.7 KiB272209

event_attr.hH A D25-Apr-20252.1 KiB6432

event_fd.cppH A D25-Apr-202511.3 KiB334268

event_fd.hH A D25-Apr-20255.5 KiB16186

event_selection_set.cppH A D25-Apr-202532.8 KiB1,016868

event_selection_set.hH A D25-Apr-20258.7 KiB255169

event_selection_set_test.cppH A D25-Apr-20254.1 KiB9871

event_table.jsonH A D25-Apr-202598 KiB1,0571,056

event_table_generator.pyH A D25-Apr-202512.2 KiB337260

event_type.cppH A D25-Apr-202517.4 KiB593497

event_type.hH A D25-Apr-20254.2 KiB13890

get_test_data.hH A D25-Apr-20256.9 KiB14854

gtest_main.cppH A D25-Apr-20253.7 KiB14195

kallsyms.cppH A D25-Apr-20258.4 KiB289222

kallsyms.hH A D25-Apr-20251.8 KiB6021

kallsyms_test.cppH A D25-Apr-20254.5 KiB146105

libsimpleperf_report_fuzzer.cppH A D25-Apr-20252.9 KiB8861

main.cppH A D25-Apr-20253.2 KiB8245

perf_event.hH A D25-Apr-2025950 3111

perf_regs.cppH A D25-Apr-20258 KiB281240

perf_regs.hH A D25-Apr-20252.9 KiB11380

perf_regs_test.cppH A D25-Apr-20251.2 KiB4019

profcollect.cppH A D25-Apr-20254.3 KiB141104

read_apk.cppH A D25-Apr-20256 KiB172129

read_apk.hH A D25-Apr-20253.4 KiB9550

read_apk_test.cppH A D25-Apr-20253.5 KiB8657

read_dex_file.cppH A D25-Apr-20253.4 KiB9468

read_dex_file.hH A D25-Apr-20251.5 KiB4823

read_dex_file_test.cppH A D25-Apr-20251.5 KiB4522

read_elf.cppH A D25-Apr-202520.8 KiB617525

read_elf.hH A D25-Apr-20253.6 KiB11875

read_elf_test.cppH A D25-Apr-20259.1 KiB276206

read_symbol_map.cppH A D25-Apr-20252.7 KiB11070

read_symbol_map.hH A D25-Apr-20251.1 KiB3915

read_symbol_map_test.cppH A D25-Apr-20254 KiB12174

record.cppH A D25-Apr-202558.8 KiB1,7491,607

record.hH A D25-Apr-202520.4 KiB720524

record_equal_test.hH A D25-Apr-20254.7 KiB12197

record_file.hH A D25-Apr-202510.9 KiB300201

record_file.protoH A D25-Apr-20251.4 KiB6150

record_file_format.hH A D25-Apr-20253.7 KiB15961

record_file_reader.cppH A D25-Apr-202530.7 KiB976885

record_file_test.cppH A D25-Apr-202512.5 KiB345251

record_file_writer.cppH A D25-Apr-202521.4 KiB696596

record_lib_interface.cppH A D25-Apr-20257.7 KiB298242

record_lib_test.cppH A D25-Apr-20255.4 KiB149118

record_test.cppH A D25-Apr-20259.2 KiB232179

report_lib_interface.cppH A D25-Apr-202526 KiB796670

report_utils.cppH A D25-Apr-202518.7 KiB532432

report_utils.hH A D25-Apr-20254.7 KiB160102

report_utils_test.cppH A D25-Apr-202528.2 KiB633520

sample_tree.hH A D25-Apr-202512 KiB351267

sample_tree_test.cppH A D25-Apr-20258.5 KiB243190

simpleperf.rcH A D25-Apr-2025480 107

simpleperf_dict.dictH A D25-Apr-202514 11

simpleperf_writer_fuzzer.cppH A D25-Apr-20256.5 KiB178148

test_util.cppH A D25-Apr-20256.1 KiB188146

test_util.hH A D25-Apr-20257.6 KiB206162

thread_tree.cppH A D25-Apr-202514.1 KiB441364

thread_tree.hH A D25-Apr-20256.2 KiB178119

thread_tree_test.cppH A D25-Apr-20254.7 KiB160106

tracing.cppH A D25-Apr-202519.2 KiB650551

tracing.hH A D25-Apr-20253.6 KiB13088

tracing_test.cppH A D25-Apr-20254.4 KiB10775

utils.cppH A D25-Apr-202514.1 KiB526454

utils.hH A D25-Apr-20258.1 KiB299223

utils_test.cppH A D25-Apr-20254 KiB12285

workload.cppH A D25-Apr-20256.8 KiB230188

workload.hH A D25-Apr-20252.4 KiB8046

workload_test.cppH A D25-Apr-20252.5 KiB8351

README.md

1# Simpleperf
2
3Android Studio includes a graphical front end to Simpleperf, documented in
4[Inspect CPU activity with CPU Profiler](https://developer.android.com/studio/profile/cpu-profiler).
5Most users will prefer to use that instead of using Simpleperf directly.
6
7If you prefer to use the command line, Simpleperf is a versatile command-line
8CPU profiling tool included in the NDK for Mac, Linux, and Windows.
9
10This file contains documentation for simpleperf maintainers.
11
12There is also [user documentation](doc/README.md).
13
14## Building new prebuilts
15
16To snap the aosp-simpleperf-release branch to ToT AOSP main and kick off a
17build, use [this coastguard
18page](https://android-build.googleplex.com/coastguard/dashboard/5938649007521792/#/request/create)
19and choose "aosp-simpleperf-release" from the "Branch" dropdown. Then click
20"Submit build requests". You'll get emails keeping you up to date with the
21progress of the snap and the build.
22
23## Updating the prebuilts
24
25Once you have the build id (a 7-digit number) and the build is complete, run the
26update script from within the `system/extras/simpleperf` directory:
27```
28$ ./scripts/update.py --build 1234567
29```
30
31This will create a new change that you can `repo upload`, then approve and
32submit as normal.
33
34For testing, I usually only run python host tests as below:
35```
36$ ./scripts/test/test.py --only-host-test
37```
38
39To test all scripts, please use python 3.8+ and install below packages:
40```
41$ pip install bokeh jinja2 pandas protobuf textable
42```
43
44## Updating the prebuilts in prebuilts/simpleperf
45
46Download ndk branch.
47```
48$ repo init -u persistent-https://android.git.corp.google.com/platform/manifest -b master-ndk
49$ repo sync
50```
51
52In prebuilts/simpleperf, run `update.py`:
53```
54$ ./update.py --build <bid>
55```
56
57Then manually edit `ChangeLog`.
58This will create a new change that you can `repo upload`, then approve and submit as normal.
59
60For testing, we need to test if the scripts run on darwin/linux/windows for different android
61versions. I usually split it to four parts:
62
631. Test on android emulators running on linux x86_64 host, for android version N/O/P/Q/R/S/current.
64
65```
66$ ./test/test.py -d <devices> -r 3
67```
68
69The scripts support android >= N. But it's easier to test old versions on emulators. So I only test
70android N on emulators.
71
72Currently, the tests have problems in clean up. So tests on emulator may fail and take too long to
73run. And there are a few known failed cases. Hopefully they will be fixed soon.
74
751. Test on android devices connected to linux x86_64 host, for android version O/P/Q/R/S/current.
76
77```
78$ ./test/test.py -d <devices> -r 3
79```
80
813. Test on an android device connected to darwin x86_64 host, for one of android version O/P/Q/R/S/current.
82
83```
84$ ./test/test.py -d <devices> -r 1
85```
86
874. Test on an android device connected to darwin x86_64 host, for one of android version O/P/Q/R/S/current.
88
89```
90$ ./test/test.py -d <devices> -r 1
91```
92
93To check simpleperf contents released in ndk, we can build ndk package.
94```
95$ <top_dir>/ndk/checkbuild.py --package --system linux --module simpleperf
96```
97
98The ndk package is generated in `out/` directory.
99