package tracing

  1. Overview
  2. Docs

High-speed global trace writing with timestamps for programs to record information for debugging and optimization as they run. Does some of the work up-front so that the writing path is as efficient as possible. The goal is for each event written (start and stop of a duration is two events) to take less than 10ns.

There are only fast paths for a limited set of events that are composed of only a header word, which can be easily pre-computed, and a timestamp word. Everything else can be written using the exposed global_writer.

This is a separate library rather than part of Tracing_zero so that it's possible to have tools which write trace data without creating a global trace writer. For example so a trace collector process wouldn't need to handle weird cases where it tries to connect to itself.

val set_destination : (module Tracing_zero.Writer.Expert.Destination) -> unit
val close : unit -> unit

Signals that the program is done writing events and to flush all pending events

val global_writer : Tracing_zero.Writer.t

Many things don't have a special fast path, and can be written directly to the trace using this writer. Event arguments for probes must be written using Writer.Expert.Write_arg_unchecked.

The thread ID that events are recorded to representing execution on the main thread

module Event : sig ... end

Represents a pre-computed event header that can be quickly written along with a hardware timestamp into the global trace.

module For_testing : sig ... end