Build option and integration for Perfetto tracing
The Perfetto project provides low-overhead tracing instrumentation and infrastructure that makes performance analysis and communication easier. For example, once a performance problem has been reproduced and recorded, the Perfetto UI allows you to generate a convenient cloud link for sharing the trace with other team members, such as this example showing virglrenderer and mesa events:
https://ui.perfetto.dev/#!/?s=f4936418e5c2b7958e47572f9859d9cd9c92359f3497fbdd6eb11a239cae93
Percetto provides a C API wrapper library for the C++ Perfetto SDK. There is now a Percetto tracing build option for virglrenderer.
A Perfetto integration into Mesa would provide visibility into low and high frequency CPU functions of interest, and eventually GPU tracing showing GPU processing stages along with relevant counters. All events would be grouped into categories so that events can be enabled or disabled by category when necessary to manage the trace capture overhead.
The Percetto C API is provided as macros for optional compile-time enabling, and would be disabled in the default mesa build.