mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-08 03:47:57 -04:00
update test
This commit is contained in:
parent
e50175298b
commit
73283b2fc6
2 changed files with 1025 additions and 808 deletions
1814
test/t1.expected
1814
test/t1.expected
File diff suppressed because it is too large
Load diff
19
test/t1.ml
19
test/t1.ml
|
|
@ -6,12 +6,29 @@ let run () =
|
|||
|
||||
for _i = 1 to 50 do
|
||||
Trace.with_span ~__FILE__ ~__LINE__ "outer.loop" @@ fun _sp ->
|
||||
let pseudo_async_sp =
|
||||
Trace.enter_explicit_span ~surrounding:None ~__FILE__ ~__LINE__
|
||||
"fake_sleep"
|
||||
in
|
||||
|
||||
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.message "world";
|
||||
Trace.counter_int "n" !n
|
||||
Trace.counter_int "n" !n;
|
||||
|
||||
if _j = 2 then (
|
||||
(* fake micro sleep *)
|
||||
let _sp =
|
||||
Trace.enter_explicit_span ~surrounding:(Some pseudo_async_sp)
|
||||
~__FILE__ ~__LINE__ "sub-sleep"
|
||||
in
|
||||
Thread.delay 0.005;
|
||||
Trace.exit_explicit_span _sp
|
||||
) else if _j = 3 then
|
||||
(* pretend some task finished. Note that this is not well scoped wrt other spans. *)
|
||||
Trace.exit_explicit_span pseudo_async_sp
|
||||
done
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue