1 unstable release
0.7.0 | Sep 16, 2024 |
---|
#237 in Profiling
209 downloads per month
Used in tracing-profile
2.5MB
43K
SLoC
Perfetto-sys
This crate wraps the perfetto sdk. Use it as follows:
Create a PerfettoGuard
which will live for the duration of the tracing session via PerfettoGuard::new()
.
To create a span, create a TraceEvent
via TraceEvent::new(<event name>)
. The event will persist until the TraceEvent
is dropped.
The crate allows you to generate compile-time defined categories of events and counters by specifying the path to a JSON file in PERFETTO_INTERFACE_FILE
environment variable during the build. See InterfaceData
structure in build.rs
for reference.
data_sources {
config {
name: "track_event"
}
}
Note that the PerfettoGuard
currently causes the thread to block until it establishes a connection to the tracing service.
Building the deb package
cd deb
dpkg --build perfetto
sudo dpkg -i perfetto
sudo dpkg -r perfetto
In process mode
When using in-process mode, all the data will be written to a local file, path to which can be set by passing the argument to init_perfetto
function. If the value is null tracing.perfetto-trace
will be used as a default value. When system mode is chosen this argument is ignored.