Logging, runtime tracing, and the obs performance profiler for OCaml
0

Configure Feed

Select the types of activity you want to include in your feed.

observe: GC-section CPU time agrees with the budget cpu

The GC section showed CPU time = wall x domains (capacity), which read
34.229s right under the budget cpu=2.498s and made GC overhead (% of CPU)
meaningless for an idle guest (0.02% of wall vs 0.22% of on-CPU). Use the
budget cpu (wall - blocked - gc) so the two numbers match and the overhead
is a fraction of time actually spent computing.

+4 -2
+4 -2
lib/obs/memtrace_eio.ml
··· 1125 1125 let running = 1126 1126 Hashtbl.fold (fun _ (f : fiber_acc) acc -> acc +. f.run_time) t.fibers 0. 1127 1127 in 1128 - (* CPU time approximated as wall per domain summed; cap GC by it. *) 1129 - let cpu_time = wall_time *. float_of_int (Stdlib.max 1 n_domains) in 1128 + (* On-CPU time: wall minus what was blocked off-CPU or in GC -- the same cpu 1129 + the budget reports, so the GC section agrees with it. An idle unikernel is 1130 + mostly waiting, not on-CPU, so this is far below wall. *) 1131 + let cpu_time = Stdlib.max 0. (wall_time -. t.blocked_time -. gc_time) in 1130 1132 let gc_overhead = safe_div gc_time cpu_time in 1131 1133 let blocked_frac = safe_div t.blocked_time wall_time in 1132 1134 let gc_frac = safe_div gc_time wall_time in