tree: a262edab64eb5a59ac592de783a196d1ee17d242 [path history] [tgz]
  1. app_api/
  2. demo/
  3. doc/
  4. include/
  5. nonlinux_support/
  6. runtest/
  7. rust/
  8. scripts/
  9. simpleperf_app_runner/
  10. testdata/
  11. .gitignore
  12. Android.bp
  13. branch_list.proto
  14. BranchListFile.cpp
  15. BranchListFile.h
  16. BranchListFile_test.cpp
  17. build_id.h
  18. callchain.h
  19. CallChainJoiner.cpp
  20. CallChainJoiner.h
  21. CallChainJoiner_test.cpp
  22. cmd_api.cpp
  23. cmd_api_impl.h
  24. cmd_api_test.cpp
  25. cmd_boot_record.cpp
  26. cmd_boot_record_test.cpp
  27. cmd_debug_unwind.cpp
  28. cmd_debug_unwind_test.cpp
  29. cmd_dumprecord.cpp
  30. cmd_dumprecord_test.cpp
  31. cmd_help.cpp
  32. cmd_inject.cpp
  33. cmd_inject_test.cpp
  34. cmd_kmem.cpp
  35. cmd_kmem_test.cpp
  36. cmd_list.cpp
  37. cmd_list_test.cpp
  38. cmd_merge.cpp
  39. cmd_merge_test.cpp
  40. cmd_monitor.cpp
  41. cmd_monitor_test.cpp
  42. cmd_record.cpp
  43. cmd_record_impl.h
  44. cmd_record_test.cpp
  45. cmd_report.cpp
  46. cmd_report_sample.cpp
  47. cmd_report_sample.proto
  48. cmd_report_sample_test.cpp
  49. cmd_report_test.cpp
  50. cmd_stat.cpp
  51. cmd_stat_impl.h
  52. cmd_stat_test.cpp
  53. cmd_trace_sched.cpp
  54. cmd_trace_sched_test.cpp
  55. command.cpp
  56. command.h
  57. command_test.cpp
  58. cpu_hotplug_test.cpp
  59. dso.cpp
  60. dso.h
  61. dso_test.cpp
  62. environment.cpp
  63. environment.h
  64. environment_test.cpp
  65. ETMConstants.h
  66. ETMDecoder.cpp
  67. ETMDecoder.h
  68. ETMRecorder.cpp
  69. ETMRecorder.h
  70. event_attr.cpp
  71. event_attr.h
  72. event_fd.cpp
  73. event_fd.h
  74. event_selection_set.cpp
  75. event_selection_set.h
  76. event_selection_set_test.cpp
  77. event_table.json
  78. event_table_generator.py
  79. event_type.cpp
  80. event_type.h
  81. get_test_data.h
  82. gtest_main.cpp
  83. IOEventLoop.cpp
  84. IOEventLoop.h
  85. IOEventLoop_test.cpp
  86. JITDebugReader.cpp
  87. JITDebugReader.h
  88. JITDebugReader_impl.h
  89. JITDebugReader_test.cpp
  90. kallsyms.cpp
  91. kallsyms.h
  92. kallsyms_test.cpp
  93. libsimpleperf_report_fuzzer.cpp
  94. main.cpp
  95. MapRecordReader.cpp
  96. MapRecordReader.h
  97. MapRecordReader_test.cpp
  98. NOTICE
  99. OfflineUnwinder.cpp
  100. OfflineUnwinder.h
  101. OfflineUnwinder_impl.h
  102. OfflineUnwinder_test.cpp
  103. OWNERS
  104. perf_event.h
  105. perf_regs.cpp
  106. perf_regs.h
  107. perf_regs_test.cpp
  108. ProbeEvents.cpp
  109. ProbeEvents.h
  110. ProbeEvents_test.cpp
  111. profcollect.cpp
  112. read_apk.cpp
  113. read_apk.h
  114. read_apk_test.cpp
  115. read_dex_file.cpp
  116. read_dex_file.h
  117. read_dex_file_test.cpp
  118. read_elf.cpp
  119. read_elf.h
  120. read_elf_test.cpp
  121. read_symbol_map.cpp
  122. read_symbol_map.h
  123. read_symbol_map_test.cpp
  124. README.md
  125. record.cpp
  126. record.h
  127. record_equal_test.h
  128. record_file.h
  129. record_file.proto
  130. record_file_format.h
  131. record_file_reader.cpp
  132. record_file_test.cpp
  133. record_file_writer.cpp
  134. record_lib_interface.cpp
  135. record_lib_test.cpp
  136. record_test.cpp
  137. RecordFilter.cpp
  138. RecordFilter.h
  139. RecordFilter_test.cpp
  140. RecordReadThread.cpp
  141. RecordReadThread.h
  142. RecordReadThread_test.cpp
  143. RegEx.cpp
  144. RegEx.h
  145. RegEx_test.cpp
  146. report_lib_interface.cpp
  147. report_utils.cpp
  148. report_utils.h
  149. report_utils_test.cpp
  150. sample_tree.h
  151. sample_tree_test.cpp
  152. SampleComparator.h
  153. SampleDisplayer.h
  154. simpleperf.rc
  155. simpleperf_dict.dict
  156. simpleperf_writer_fuzzer.cpp
  157. TEST_MAPPING
  158. test_util.cpp
  159. test_util.h
  160. thread_tree.cpp
  161. thread_tree.h
  162. thread_tree_test.cpp
  163. tracing.cpp
  164. tracing.h
  165. tracing_test.cpp
  166. utils.cpp
  167. utils.h
  168. utils_test.cpp
  169. workload.cpp
  170. workload.h
  171. workload_test.cpp
  172. ZstdUtil.cpp
  173. ZstdUtil.h
  174. ZstdUtil_test.cpp
simpleperf/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.