mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-08 03:47:57 -04:00
19 lines
496 B
OCaml
19 lines
496 B
OCaml
let run () =
|
|
Trace.set_process_name "main";
|
|
Trace.set_thread_name "t1";
|
|
|
|
let n = ref 0 in
|
|
|
|
for _i = 1 to 50 do
|
|
Trace.with_span ~__FILE__ ~__LINE__ "outer.loop" @@ fun _sp ->
|
|
for _j = 2 to 5 do
|
|
incr n;
|
|
Trace.with_span ~__FILE__ ~__LINE__ "inner.loop" @@ fun _sp ->
|
|
Trace.messagef (fun k -> k "hello %d %d" _i _j);
|
|
Trace.counter_int "n" !n
|
|
done
|
|
done
|
|
|
|
let () =
|
|
Trace_tef.Internal_.mock_all_ ();
|
|
Trace_tef.with_setup ~out:`Stdout @@ fun () -> run ()
|