wiki/perf add perfetto and call-graph info

This commit is contained in:
Mathieu Maret 2023-03-10 14:05:05 +01:00
parent 176cdc8069
commit 0dce3064a3
1 changed files with 78 additions and 1 deletions

View File

@ -6,6 +6,83 @@
./report_html.py -i perf.data
=== Perf camera server ===
./run_simpleperf_on_device.py record -g -p $( adb shell ps | grep camera.provider | awk '{print $2}') --duration 5 -o perf_test.data
./run_simpleperf_on_device.py record -g -p $( adb shell ps | grep camera.provider | awk '{print $2}') --duration 5 -o perf_test.data
adb pull /data/local/tmp/perf_test.data .
./report_html.py -i perf_test.data
=== 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