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