2022-10-19 16:27:14 +02:00
== Generate perf rapport ==
cd /home/mmaret/Android/Sdk/ndk/23.0.7599858/simpleperf
./run_simpleperf_on_device.py record -g /system/bin/ovt_raw_slicer -i /sdcard/4_water_explode.raw -o /sdcard/out_current.test
adb pull /data/local/tmp/perf.data .
./report_html.py -i perf.data
=== Perf camera server ===
2023-03-10 14:05:05 +01:00
./run_simpleperf_on_device.py record -g -p $( adb shell ps | grep camera.provider | awk '{print $2}') --duration 5 -o perf_test.data
2022-10-19 16:27:14 +02:00
adb pull /data/local/tmp/perf_test.data .
./report_html.py -i perf_test.data
2023-03-10 14:05:05 +01:00
=== Call Graph ===
# https://android.googlesource.com/platform/prebuilts/simpleperf/+/refs/heads/ndk-r13-release/README.md
./run_simpleperf_on_device.py record -g -p $( adb shell ps | grep camera.provider | awk '{print $2}') --duration 5 -o perf_test.data -g --symfs .
# Or, but do not seems better
./run_simpleperf_on_device.py record -g -p $( adb shell ps | grep camera.provider | awk '{print $2}') --duration 5 -o perf_test.data -g --symfs . --call-graph fp
adb shell /data/local/tmp/simpleperf report -n -g --symfs . -i /data/local/tmp/perf_test.data
adb shell /data/local/tmp/simpleperf report -n -g --symfs . -i /data/local/tmp/perf_test.data >perf.report && python3 report.py perf.report
== With perfecto ==
https://devblogs.microsoft.com/performance-diagnostics/perfetto-tooling-for-analyzing-android-linux-and-chromium-browser-performance-microsoft-performance-tools-linux-android/
https://perfetto.dev/docs/reference/trace-config-proto#PerfEventConfig
#!/usr/bin/env bash
# see https://devblogs.microsoft.com/performance-diagnostics/perfetto-tooling-for-analyzing-android-linux-and-chromium-browser-performance-microsoft-performance-tools-linux-android/
adb shell perfetto \
-c - --txt \
-o /data/misc/perfetto-traces/trace \
<<EOF
buffers: {
size_kb: 63488
fill_policy: DISCARD
}
buffers: {
size_kb: 2048
fill_policy: DISCARD
}
data_sources: {
config {
name: "linux.process_stats"
target_buffer: 1
process_stats_config {
scan_all_processes_on_start: true
}
}
}
data_sources: {
config {
name: "linux.ftrace"
ftrace_config {
ftrace_events: "sched/sched_switch"
ftrace_events: "power/suspend_resume"
ftrace_events: "sched/sched_wakeup"
ftrace_events: "sched/sched_wakeup_new"
ftrace_events: "sched/sched_waking"
ftrace_events: "sched/sched_process_exit"
ftrace_events: "sched/sched_process_free"
ftrace_events: "task/task_newtask"
ftrace_events: "task/task_rename"
}
}
}
data_sources: {
config {
name: "linux.perf"
perf_event_config {
timebase {
frequency: 1000
}
callstack_sampling {
kernel_frames: true
}
target_cmdline: "vendor.qti.camera.provider@2.7-service_64"
}
}
}
duration_ms: 8000
EOF
adb pull /data/misc/perfetto-traces/trace