1. Overview
  2. Docs

The magic-trace tool can work with any binary, but using these functions allows you to easily mark places in your code to take a snapshot, and enables additional features like passing a value and marking the start of a duration.

val take_snapshot : unit -> unit

This is the default symbol that the magic-trace command will attach to and use to take a snapshot. Use it if you want to take a snapshot based on custom logic, and it will save you the step of selecting the symbol you want to stop on.

It's an external C function that does nothing and should be very fast to call. It's only a C function to ensure it has a stable and exact symbol.

val take_snapshot_with_arg : int -> unit

Passes an integer along that will show up in the resulting trace

val take_snapshot_with_time_and_arg : Time_stamp_counter.t -> int -> unit

Passes both the start tsc for the operation and an argument.

val mark_start : unit -> unit

Mark the start time of some operation which may lead to a snapshot.

module Min_duration : sig ... end

Intended for use like so:

module Private : sig ... end

Internal details about how to interact with the snapshot function from outside