Lines Matching refs:simpleperf
8 …ource code is [here](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/).
9 … [here](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/README.md).
14 - [Tools in simpleperf](#tools-in-simpleperf)
26 - [How simpleperf works](#how-simpleperf-works)
69 Simpleperf contains two parts: the simpleperf executable and Python scripts.
71 The simpleperf executable works similar to linux-tools-perf, but has some specific features for
75 report on the host", simpleperf not only collects samples in profiling data, but also collects
79 a. When recording dwarf based call graph, simpleperf unwinds the stack before writing a sample
95 simpleperf executables can be pushed on any Android device and used to record profiling data.
101 Detailed documentation for the simpleperf executable is [here](#executable-commands-reference).
113 ## Tools in simpleperf
115 The simpleperf executables and Python scripts are located in simpleperf/ in ndk releases, and in
116 system/extras/simpleperf/scripts/ in AOSP. Their functions are listed below.
120 bin/android/${arch}/simpleperf: static simpleperf executables used on the device.
122 bin/${host}/${arch}/simpleperf: simpleperf executables used on the host, only supports reporting.
152 …[Here](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/demo/README.md).
167 enables JNI checks and may not optimize C/C++ code. It can be profiled by simpleperf without any
174 with android::debuggable set to true can be profiled. So simpleperf can only profile a release
228 On Android >= P, simpleperf supports profiling Java code, no matter whether it is executed by
231 On Android O, simpleperf supports profiling Java code which is compiled into native instructions,
235 On Android N, simpleperf supports profiling Java code that is compiled into native instructions.
238 On Android <= M, simpleperf doesn't support profiling Java code.
241 …tive](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/demo/SimpleperfE…
246 $ cd extras/simpleperf/demo
261 # Cd to the directory of simpleperf scripts. Record perf.data.
267 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative --compile_java_code \
280 Cmdline: /data/data/com.example.simpleperf.simpleperfexamplewithnative/simpleperf record ...
313 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative \
317 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative \
381 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative -a .SleepActivity \
393 # Start simpleperf recording, then start the Activity to profile.
394 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative -a .MainActivity
398 # 2. Start simpleperf recording.
399 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative
413 1. After running `adb root`, simpleperf can be used to profile any process or system wide.
414 2. It is recommended to use the latest simpleperf available in AOSP master, if you are not working
415 on the current master branch. Scripts are in `system/extras/simpleperf/scripts`, binaries are in
416 `system/extras/simpleperf/scripts/bin/android`.
434 # Doing recording with app_profiler.py or simpleperf on device, and generates perf.data on host.
449 ### How simpleperf works
457 exposes all events to userspace via the perf_event_open system call, which is used by simpleperf.
463 1. Given user options, simpleperf enables profiling by making a system call to the kernel.
465 3. After profiling, simpleperf reads counters from the kernel, and reports a counter summary.
468 1. Given user options, simpleperf enables profiling by making a system call to the kernel.
469 2. Simpleperf creates mapped buffers between simpleperf and the kernel.
483 The debug-unwind command: debug/test dwarf based offline unwinding, used for debugging simpleperf.
484 The dump command: dumps content in perf.data, used for debugging simpleperf.
491 simpleperf in Android Studio.
500 $ simpleperf --help
503 $ simpleperf record --help
514 $ simpleperf list
542 $ simpleperf stat -p 7394 --duration 10
561 $ simpleperf stat -e cpu-cycles -p 11904 --duration 10
564 $ simpleperf stat -e cache-references,cache-misses -p 11904 --duration 10
575 $ simpleperf stat -p 7394 -e cache-references,cache-references:u,cache-references:k \
596 $ simpleperf stat -p 7964 --group cache-references,cache-misses \
620 $ simpleperf stat -p 11904,11905 --duration 10
623 $ simpleperf stat -t 11904,11905 --duration 10
626 $ simpleperf stat ls
630 $ simpleperf stat --app com.example.simpleperf.simpleperfexamplewithnative
633 $ simpleperf stat -a --duration 10
639 monitoring a child process running a new command, simpleperf monitors until the child process ends.
644 $ simpleperf stat -p 11904 --duration 10
647 $ simpleperf stat ls
650 $ simpleperf stat -p 11904 --duration 10
655 SIGHUP signals to simpleperf to stop monitoring.
663 $ simpleperf stat -p 11904 --duration 10 --interval 300
667 $ su 0 simpleperf stat -a --duration 10 --interval 300
678 $ su 0 simpleperf stat -e instructions:k,cache-misses -a --interval 300 --duration 15
696 $ simpleperf record -p 7394 --duration 10
697 simpleperf I cmd_record.cpp:316] Samples recorded: 21430. Samples lost: 0.
707 $ simpleperf record -e instructions -p 11904 --duration 10
710 $ simpleperf record -e task-clock -p 11904 --duration 10
719 $ simpleperf record -p 11904,11905 --duration 10
722 $ simpleperf record -t 11904,11905 --duration 10
725 $ simpleperf record ls
729 $ simpleperf record --app com.example.simpleperf.simpleperfexamplewithnative
732 $ simpleperf record -a --duration 10
739 thread runs 0.2s in one second (it can be preempted or blocked in other times), simpleperf dumps
745 $ simpleperf record -f 1000 -p 11904,11905 --duration 10
748 $ simpleperf record -c 100000 -t 11904,11905 --duration 10
758 $ simpleperf record -f 1000 -p 11904,11905 --duration 10 --cpu-percent 50
767 $ simpleperf record -p 11904 --duration 10
770 $ simpleperf record ls
773 $ simpleperf record -p 11904 --duration 10
778 SIGHUP signals to simpleperf to stop monitoring.
782 By default, simpleperf stores profiling data in perf.data in the current directory. But the path
787 $ simpleperf record -p 11904 -o data/perf2.data --duration 10
824 $ simpleperf record -p 11904 -g --duration 10
827 $ simpleperf record -p 11904 --call-graph fp --duration 10
840 When --trace-offcpu is used, simpleperf generates a sample when a running thread is scheduled out,
851 $ simpleperf list --show-features
860 $ simpleperf record -g -p 11904 --duration 10 --trace-offcpu
863 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative -a .SleepActivity \
871 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative -a .SleepActivity
881 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative -a .SleepActivity \
911 $ simpleperf report --dsos /data/app/com.example.sudogame-2/lib/arm64/libsudo-game-jni.so \
913 Cmdline: /data/data/com.example.sudogame/simpleperf record -p 7394 --duration 10
932 $ simpleperf report -i data/perf2.data
937 To report function symbols, simpleperf needs to read executable binaries used by the monitored
944 # In this case, when simpleperf wants to read executable binary /A/b, it reads file in /A/b.
945 $ simpleperf report
947 # In this case, when simpleperf wants to read executable binary /A/b, it prefers file in
949 $ simpleperf report --symfs /debug_dir
953 $ simpleperf report --symfs $ANDROID_PRODUCT_OUT/symbols
963 $ simpleperf report --comms sudogame
966 $ simpleperf report --pids 7394,7395
969 $ simpleperf report --tids 7394,7395
972 $ simpleperf report --dsos /data/app/com.example.sudogame-2/lib/arm64/libsudo-game-jni.so
982 $ simpleperf report --sort pid
986 $ simpleperf report --sort tid,comm
990 $ simpleperf report --sort dso,symbol
994 $ simpleperf report
1004 $ simpleperf report -g
1016 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative
1019 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative --compile_java_code
1022 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative -a .SleepActivity
1035 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative \
1039 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative \
1043 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative -o perf_custom.data
1056 --app com.example.simpleperf.simpleperfexamplewithnative \
1065 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative -a .MainActivity
1076 -p com.example.simpleperf.simpleperfexamplewithnative
1094 when you record profiling data using `simpleperf record` directly, to do system wide profiling or
1112 This script pushes the simpleperf executable on the device, and run a simpleperf command on the
1159 $ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative
1280 …here](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/demo/SimpleperfE…
1290 The simpleperf record command collects symbols on device in perf.data. But if the native libraries
1315 … listed [here](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/OWNERS).
1317 If you want to compile simpleperf C++ source code, follow below steps:
1319 2. Build simpleperf.
1323 $ mmma system/extras/simpleperf -j30
1326 If built successfully, out/target/product/generic_arm64/system/bin/simpleperf is for ARM64, and