Skip to content

Commit

Permalink
break tef: use mtime.now, not a counter, for multiproc
Browse files Browse the repository at this point in the history
this allows us to correlate timestamps among processes on the same
machine.
  • Loading branch information
c-cube committed Aug 21, 2024
1 parent 5b677e5 commit ff8c7e5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/tef/trace_tef.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ module Mock_ = struct
float_of_int x
end

let counter = Mtime_clock.counter ()

(** Now, in microseconds *)
let[@inline] now_us () : float =
if !Mock_.enabled then
Mock_.now_us ()
else (
let t = Mtime_clock.count counter in
Mtime.Span.to_float_ns t /. 1e3
let t = Mtime_clock.now () in
Int64.to_float (Mtime.to_uint64_ns t) /. 1e3
)

let on_tracing_error = ref (fun s -> Printf.eprintf "trace-tef error: %s\n%!" s)
Expand Down

0 comments on commit ff8c7e5

Please sign in to comment.