diff --git a/example/burn.ml b/example/burn.ml index aa7224d..9b9decd 100644 --- a/example/burn.ml +++ b/example/burn.ml @@ -1,8 +1,7 @@ open Eio let woops_sleepy ~clock = - Eio_name.name "sleeper"; - Switch.run ~name:"sleeper" @@ fun sw -> + Switch.run ~name:"unix sleeper ctx" @@ fun sw -> Fiber.fork ~sw (fun () -> Eio_name.name "unix sleeper"; (* Woops! Wrong sleep function, we blocked the fiber *) @@ -16,7 +15,7 @@ let spawn ~clock min max = for _i = 0 to 100 do ignore (Sys.opaque_identity @@ Array.init 1000000 float_of_int) done; - Switch.run @@ fun sw -> + Switch.run ~name:"spawn ctx" @@ fun sw -> for i = min to max do Fiber.fork ~sw (fun () -> Eio_name.name (Fmt.str "worker>%d" i); @@ -37,6 +36,7 @@ let spawn ~clock min max = let main clock = let p, r = Promise.create () in Switch.run ~name:"main" @@ fun sw -> + Eio_name.name "main fiber"; (* A long running task *) Fiber.fork ~sw (fun () -> Eio_name.name "waiter"; diff --git a/src/lib/meio.ml b/src/lib/meio.ml index da1b006..6f5849e 100644 --- a/src/lib/meio.ml +++ b/src/lib/meio.ml @@ -16,7 +16,9 @@ let task_events ~latency_begin ~latency_end q = | `Create (fiber, `Fiber_in parent) -> Queue.push q (`Created ((fiber :> int), parent, d, ts, e)) | `Create (id, `Cc _) -> - Queue.push q (`Created ((id :> int), !current_id, d, ts, e)) + Queue.push q (`Created ((id :> int), !current_id, d, ts, e)); + (* Bit of a hack -- eio could label this for us? *) + if id = 0 then Queue.push q (`Name (id, "root")) | `Suspend_fiber _ -> current_id := -1; Queue.push q (`Suspend (d, ts))