From e34d6dade37566131c0c0d7e91f9ccbf44fc9af1 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 29 Aug 2023 22:33:41 -0400 Subject: [PATCH] update test --- test/t1.expected | 2 +- test/t1.ml | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/t1.expected b/test/t1.expected index b155346..c84ae1e 100644 --- a/test/t1.expected +++ b/test/t1.expected @@ -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"}, diff --git a/test/t1.ml b/test/t1.ml index 181f397..49ff68f 100644 --- a/test/t1.ml +++ b/test/t1.ml @@ -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