update test

This commit is contained in:
Simon Cruanes 2023-08-29 22:33:41 -04:00
parent 8a4309b95e
commit e34d6dade3
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 6 additions and 4 deletions

View file

@ -20,7 +20,7 @@
{"pid":2,"cat":"","tid": 3,"ts": 22.00,"name":"world","ph":"I"},
{"pid":2,"tid":3,"ts":23.00,"name":"c","ph":"C","args": {"n":4}},
{"pid":2,"cat":"","tid": 3,"dur": 4.00,"ts": 20.00,"name":"inner.loop","ph":"X","args": {"i":1}},
{"pid":2,"cat":"","tid": 3,"dur": 25.00,"ts": 0.00,"name":"outer.loop","ph":"X"},
{"pid":2,"cat":"","tid": 3,"dur": 25.00,"ts": 0.00,"name":"outer.loop","ph":"X","args": {"slept":true}},
{"pid":2,"cat":"trace","id":7,"tid": 3,"ts": 27.00,"name":"fake_sleep","ph":"b"},
{"pid":2,"cat":"","tid": 3,"ts": 29.00,"name":"hello 2 2","ph":"I"},
{"pid":2,"cat":"","tid": 3,"ts": 30.00,"name":"world","ph":"I"},

View file

@ -17,10 +17,10 @@ let run () =
Trace.message "world";
Trace.counter_int "n" !n;
Trace.add_data_to_span _sp [ "i", `Int _i ];
Trace.add_data [ "i", `Int _i ];
if _j = 2 then (
Trace.add_data_to_span _sp [ "j", `Int _j ];
Trace.add_data [ "j", `Int _j ];
let _sp =
Trace.enter_manual_sub_span ~parent:pseudo_async_sp
~flavor:
@ -34,9 +34,11 @@ let run () =
(* fake micro sleep *)
Thread.delay 0.005;
Trace.exit_manual_span _sp
) else if _j = 3 then
) else if _j = 3 then (
(* pretend some task finished. Note that this is not well scoped wrt other spans. *)
Trace.add_data_to_manual_span pseudo_async_sp [ "slept", `Bool true ];
Trace.exit_manual_span pseudo_async_sp
)
done
done