package trace
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A lightweight stub for tracing/observability, agnostic in how data is collected
Install
dune-project
Dependency
Authors
Maintainers
Sources
trace-0.11.tbz
sha256=a29329fcfb191a98bfed26c05c300ed9e1e915b73cc59f51e9d9cdc4d1f158bc
sha512=ff77a4ef19375f4ad3b1ddff7336657a4a5695924b679ac2c36a77b14b95c63d126539efd1590f83b415a1288bb843a5fb4308e53a807dcc22456cb40a8e0026
doc/src/trace.util/mock_.ml.html
Source file mock_.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46(** Mocking for tests *) module Inner = struct let mock = ref false let get_now_ns_ref = ref Time_util.get_time_ns let get_tid_ref = ref Thread_util.get_tid let get_pid_ref = ref Unix_util.get_pid (** used to mock timing *) let make_time_mock () : unit -> int64 = let time_ = ref 0 in let get_now_ns () : int64 = let x = !time_ in incr time_; Int64.(mul (of_int x) 1000L) in get_now_ns end (** Now, in nanoseconds. Uses {!get_now_ns_ref} *) let[@inline] now_ns () : int64 = if !Inner.mock then !Inner.get_now_ns_ref () else Time_util.get_time_ns () (** Current thread's ID. Uses {!get_tid_ref} *) let[@inline] get_tid () : int = if !Inner.mock then !Inner.get_tid_ref () else Thread_util.get_tid () let[@inline] get_pid () : int = if !Inner.mock then !Inner.get_pid_ref () else Unix_util.get_pid () let mock_all () : unit = Inner.mock := true; (Inner.get_pid_ref := fun () -> 2); (Inner.get_tid_ref := fun () -> 3); Inner.get_now_ns_ref := Inner.make_time_mock (); ()
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>