mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
one can now give tasks an optional string "name". If `Trace` is present (installed) and enabled, this results in a span around the task's execution. This also plays ok with `await` and other effect-based primitives.
13 lines
336 B
OCaml
13 lines
336 B
OCaml
module Trace = Trace_core
|
|
|
|
let enabled = Trace.enabled
|
|
let dummy_span = Int64.min_int
|
|
let dummy_file_ = "<unknown file>"
|
|
|
|
let[@inline] enter_span name : int64 =
|
|
if name = "" then
|
|
dummy_span
|
|
else
|
|
Trace.enter_span ~__FILE__:dummy_file_ ~__LINE__:0 name
|
|
|
|
let[@inline] exit_span sp = if sp <> dummy_span then Trace.exit_span sp
|