This module implements a serializer for the trace data recorded with the Tracer facility into the "Chrome Trace Event" JSON format, which is a simple JSON-based format used for representing trace data. The format is understood by Google Chrome's built-in "Trace Viewer" as well as other trace/flamegraph visualizers, such as "Speedscope".
For a specification, see https
"Complete" events (X) were used originally, as it meant less output to write, but because of the issues it caused with visualizers in some cases, "Begin" (B) and "End" (E) events are now used instead.
While not strictly necessary, a manual JSON serializer is used instead of std/json for efficiency.
Procs
proc writeToStream(t: Tracer; stream: Stream) {. ...raises: [IOError, OSError, Exception], tags: [WriteIOEffect].}
- Serializes all events and associated data recorded with t into the "Chrome Trace Event" JSON Object format and outputs the result to stream Source Edit