contrib/rust-sdk/perfetto-derive/README.md
Procedural macros for the Perfetto Rust SDK.
This crate provides the #[tracefn] attribute macro for automatically
instrumenting functions with Perfetto track events. When applied to a
function, it emits a trace event spanning the function's execution and
optionally captures input parameters as event arguments.
use perfetto_sdk::track_event::*;
perfetto_sdk::track_event_categories! {
pub mod my_categories {
("rendering", "Rendering events", []),
}
}
use my_categories as perfetto_te_ns;
#[perfetto_sdk_derive::tracefn("rendering")]
fn draw_frame(width: u32, height: u32) {
// A "draw_frame" trace event is emitted automatically,
// capturing width and height as arguments.
}
| Crate | Description |
|---|---|
perfetto-sdk | Main SDK with tracing session and track event APIs |