perfetto-sdk
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.
Quick start
use *;
track_event_categories!
use my_categories as perfetto_te_ns;
track_event_instant!;
Features
- Track events with categories, names, and typed arguments
- Data sources for custom trace data
- Protozero encoding in pure Rust for minimal overhead
- Tracing sessions for programmatic trace collection
Crate features
| Feature | Default | Description |
|---|---|---|
vendored |
yes | Statically links the bundled Perfetto C library |
intrinsics |
no | Enables branch-prediction hints to reduce trace overhead |
Related crates
| 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 |