microsoft / Microsoft-Performance-Tools-Linux-Android

Linux, Android and Chromium Performance Tools built using the Microsoft Performance Toolkit. Cross-platform .NET Core + WPA GUI
MIT License
320 stars 34 forks source link

[Feature] Perfetto - Support Processing of Android 12 CPU Callstack Sampling #38

Closed ivberg closed 2 years ago

ivberg commented 3 years ago

Having this feature would enable the Perfetto plugin to show CPU Sampling of both kernel & user-mode either at the system or process level. What is collected is dependent on the tracing config.

Users could easily see:

Perfetto trace format already seems to support collecting CPU Samples via PerfEventConfig callstack_sampling PerfEventConfig Configuration for the traced_perf profiler.

Example config for basic cpu profiling: perf_event_config { timebase { frequency: 80 } callstack_sampling { scope { target_cmdline: "surfaceflinger" target_cmdline: "system_server" } kernel_frames: true } }

Defined in perf_event_config.proto

In my testing, this did not seem to be supported on Android 11, but it did work on Android 12. This makes sense given the timestamps of the PerfEventConfig checkins.

I did verify that the data was present in the Android 12 trace and symbolic frame information was present via the trace processor CallStack Profilers tables