break tef: use mtime.now, not a counter, for multiproc

this allows us to correlate timestamps among processes on the same
machine.
This commit is contained in:
Simon Cruanes 2024-08-21 09:15:31 -04:00
parent 5b677e5cdd
commit ff8c7e5353
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -15,15 +15,13 @@ module Mock_ = struct
float_of_int x float_of_int x
end end
let counter = Mtime_clock.counter ()
(** Now, in microseconds *) (** Now, in microseconds *)
let[@inline] now_us () : float = let[@inline] now_us () : float =
if !Mock_.enabled then if !Mock_.enabled then
Mock_.now_us () Mock_.now_us ()
else ( else (
let t = Mtime_clock.count counter in let t = Mtime_clock.now () in
Mtime.Span.to_float_ns t /. 1e3 Int64.to_float (Mtime.to_uint64_ns t) /. 1e3
) )
let on_tracing_error = ref (fun s -> Printf.eprintf "trace-tef error: %s\n%!" s) let on_tracing_error = ref (fun s -> Printf.eprintf "trace-tef error: %s\n%!" s)