From cdab1c09567a485eead85b2d7a2778f79dcc766c Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 9 Apr 2025 10:35:11 -0400 Subject: [PATCH] compat OCaml 4.12 --- src/tef/trace_tef.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tef/trace_tef.ml b/src/tef/trace_tef.ml index 586fd6e..a6f4e7a 100644 --- a/src/tef/trace_tef.ml +++ b/src/tef/trace_tef.ml @@ -6,6 +6,9 @@ module A = Trace_core.Internal_.Atomic_ let on_tracing_error = ref (fun s -> Printf.eprintf "trace-tef error: %s\n%!" s) +let[@inline] int64_of_trace_id_ (id : Trace_core.trace_id) : int64 = + Bytes.get_int64_le (Bytes.unsafe_of_string id) 0 + module Mock_ = struct let enabled = ref false let now = ref 0 @@ -147,7 +150,7 @@ module Writer = struct emit_sep_and_start_ self; Printf.bprintf self.buf {json|{"pid":%d,"cat":"trace","id":%Ld,"tid": %d,"ts": %.2f,"name":%a,"ph":"%c"%a}|json} - self.pid (String.get_int64_le id 0) tid ts str_val name + self.pid (int64_of_trace_id_ id) tid ts str_val name (match flavor with | None | Some Async -> 'b' | Some Sync -> 'B') @@ -160,7 +163,7 @@ module Writer = struct emit_sep_and_start_ self; Printf.bprintf self.buf {json|{"pid":%d,"cat":"trace","id":%Ld,"tid": %d,"ts": %.2f,"name":%a,"ph":"%c"%a}|json} - self.pid (String.get_int64_le id 0) tid ts str_val name + self.pid (int64_of_trace_id_ id) tid ts str_val name (match flavor with | None | Some Async -> 'e' | Some Sync -> 'E')