contrib/rust-sdk/perfetto/README.md
Safe and ergonomic Rust bindings for the Perfetto tracing framework.
This crate provides the main API for recording trace data from Rust applications. It wraps the Perfetto C API with safe Rust abstractions for tracing sessions, data sources, and track events.
use perfetto_sdk::track_event::*;
perfetto_sdk::track_event_categories! {
pub mod my_categories {
("rendering", "Rendering events", []),
("input", "Input events", []),
}
}
use my_categories as perfetto_te_ns;
perfetto_sdk::track_event_instant!("rendering", "DrawFrame");
| Feature | Default | Description |
|---|---|---|
vendored | yes | Statically links the bundled Perfetto C library |
intrinsics | no | Enables branch-prediction hints to reduce trace overhead |
| Crate | Description |
|---|---|
perfetto-sdk-sys | Low-level FFI bindings |
perfetto-sdk-derive | Proc macros for function tracing |
perfetto-sdk-protos-gpu | GPU event protobuf bindings |