package magic-trace

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Magic_trace.Min_durationSource

Intended for use like so:

  let min_dur = Magic_trace.Min_duration.of_ns 3_000

  let my_fun a b c =
    Magic_trace.mark_start ();
    (* ... *)
    if Magic_trace.Min_duration.over min_dur then Magic_trace.take_snapshot ()
  ;;

which allows capturing only unusually long executions without adding the ~10us breakpoint overhead on every run while magic-trace is attached.

See also the -duration-thresh flag for use in combination with this or instead of it if you can tolerate a 10us pause on every call.

Sourcetype t
Sourceval of_ns : int -> t

This involves using and forcing Time_stamp_counter.calibrator so should probably be done only once at the top level as opposed to every time.

Sourceval over : t -> bool

Returns true if the time since mark_start is over the threshold

OCaml

Innovation. Community. Security.