@@ -101,18 +101,29 @@ Switches can be named using `Switch.run ~name`. Unnamed switches are shown as "s
101101A context being cancelled is indicated by a vertical red line.
102102
103103Domain-wide events, such as garbage collection and waiting for events,
104- are shown as yellow regions behind all the fibers in the domain.
105- Nested events get progressively darker yellow.
104+ are shown as coloured regions behind all the fibers in the domain.
105+ GC periods are shown in shades of red when running, or yellow when waiting.
106+ Yellow is also used when the domain is waiting for events outside of GC.
106107When there are multiple domains, they are shown stacked vertically:
107108
108109<p align =' center ' >
109110 <img src =" ./doc/gc.svg " />
110111</p >
111112
112113In the above trace, the upper domain performed GC while suspended
113- (the dark "minor" region in the top right, inside the "suspend-domain" region).
114+ (the red "minor" region in the top right, inside the "suspend-domain" region).
114115This is possible because each domain has a "backup" thread that handles GC while the domain is suspended.
115116
117+ For minor GCs:
118+ 1 . The domain initiating the GC enters a "stw_leader" (stop-the-world) phase and waits for the other domains to stop.
119+ 2 . One by one, the other domains stop and enter "stw_api_barrier" until all domains have stopped.
120+ 3 . All domains perform a minor GC, clearing their minor heaps.
121+ 4 . They then enter a "minor_leave_barrier" phase, waiting until all domains have finished.
122+ 5 . Each domain returns to running application code (including GC finalizers).
123+
124+ Phases that usually involve sleeping are shown with a yellow background, but sometimes they do perform work
125+ (the trace events don't give us enough information to know in all cases).
126+
116127## Controls
117128
118129- F5 : reload the trace file
@@ -123,7 +134,7 @@ This is possible because each domain has a "backup" thread that handles GC while
123134
124135## Limitations
125136
126- - OCaml 5.1 can [ deadlock when tracing multiple domains] ( https://github.com/ocaml/ocaml/issues/12897 ) . This should be fixed in OCaml 5.2.
137+ - OCaml 5.1 can [ deadlock when tracing multiple domains] ( https://github.com/ocaml/ocaml/issues/12897 ) . This was fixed in OCaml 5.2.
127138- Events are reported per-domain, but not per-systhread.
128139 Events generated in systhreads will get mixed up and cannot be shown correctly.
129140 They will either appear attached to whatever fiber happens to be running, or shown as domain-level events.
0 commit comments