feat(profile): enabled function

This commit is contained in:
Simon Cruanes 2021-03-24 12:06:53 -04:00
parent ff77617a5d
commit f893f14f21
2 changed files with 4 additions and 0 deletions

View file

@ -32,6 +32,8 @@ let null_probe = No_probe
(* where to print events *)
let out_ : backend option ref = ref None
let[@inline] enabled () = match !out_ with Some _ -> true | None -> false
let begin_with_ (module B:BACKEND) name : probe =
Probe {name; start=B.get_ts ()}

View file

@ -5,6 +5,8 @@ type probe
val null_probe : probe
val enabled : unit -> bool
val instant : string -> unit
val begin_ : string -> probe