Skip to main content

Module trace

Module trace 

Source
Expand description

backbeat → Chrome / Perfetto trace JSON.

Spans become async events (ph:"b"/"e", paired by id), not duration events (B/E): backbeat spans carry explicit ids, can overlap, may be emitted across different shards (thread migration), and may be orphaned by ring eviction — all of which violate the per-thread LIFO stack contract that B/E assume. Async events pair by explicit id, tolerate overlap, and need no nesting. Plain (non-span) events become instants (ph:"i").

Pairing is by (instance_id, span_id) so merged multi-process dumps never collide. Orphans (the other half evicted from the ring) are surfaced rather than dropped: an enter with no exit gets a synthetic close at the trace’s max timestamp; an exit with no enter becomes a zero-width instant.

The output is read by chrome://tracing, Perfetto, and any Trace-Event-Format consumer.

Functions§

to_trace
Writes the loaded dumps to output as Chrome Trace Event Format JSON. Returns the event count.