Magic_trace.Min_durationSourceIntended 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.