PerCetto is a minimal C wrapper for Perfetto SDK to enable app-specific
tracing. Internally, there is a minimal implementation of TrackEvent
data
source.
PerCetto works best when statically linked once for a whole process.
When linked into a shared library, PerCetto symbols should not be exported,
because percetto_init
can not yet be called multiple times.
If there are multiple instances of PerCetto in a single process, the main disadvantages are the additional binary size overhead and additional background thread for Perfetto. The binary size is typically about 450KB.
Configure and build PerCetto:
meson build
meson compile -C build
This will download and build Perfetto SDK as a Meson subproject automatically.
src
contains the source code of Percetto.
examples
contains examples to demonstrate different ways of using Percetto.
Shows various types of trace events and the use of multiple categories.
Shows how to use the Android ATRACE macro compatibility API found in percetto-atrace.h.
Shows how to manually set timestamps for events. This enables use cases where the events are added to Percetto after they have already occurred, such as GPU tracing.