pub struct Track { /* private fields */ }Expand description
Represents a custom track for grouping related trace events (e.g., state machines, status tracks).
Under the hood, this is backed by a virtual thread (VThread). A virtual thread acts like
a physical thread to the visualizer but is completely managed in userspace.
Encapsulating VThread here with a static string generic guarantees that the track name has
static lifetime, which prevents memory safety issues and makes registration cheap.
Implementations§
Source§impl Track
impl Track
Sourcepub fn new(name: &'static str) -> Self
pub fn new(name: &'static str) -> Self
Creates a new custom track with the given name.
The track is automatically grouped under the current process.
We use Id::new() to generate the underlying VThread ID. This is crucial because
virtual threads generate artificial KOIDs based on their ID. Using a random ID minimizes
the risk of cross-process fake KOID collisions in the visualizer.