package catapult
Tracing system based on the Catapult/TEF format
Install
Dune Dependency
Authors
Maintainers
Sources
v0.1.tar.gz
md5=a7bfa27c3ddd2d29c27173de09293149
sha512=49766ea38c57734918debd6218d95c62f11eb12a6fd3ef5f6a2c60344cea7c274436a46fab1e48abbe0d3f125f31705d2005ab7cae9e56d5f41778c1d2943d65
doc/src/catapult.utils/gc_stats.ml.html
Source file gc_stats.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
module P = Catapult module Atomic = P.Atomic_shim_ (* store last time we emitted GC events *) let last_gc: float Atomic.t = Atomic.make (P.Clock.now_us()) let emitting_gc = Atomic.make false let gc_interval_us = ref 1e5 let set_gc_interval_us s = gc_interval_us := s (* emit a GC counter event *) let[@inline never] emit_gc_ ~pid () = let st = Gc.quick_stat() in P.Tracing.counter "gc" ~cs:[ (Printf.sprintf "%d.major" pid), st.Gc.major_collections; (Printf.sprintf "%d.minor" pid), st.Gc.minor_collections; (Printf.sprintf "%d.compactions" pid), st.Gc.compactions; (Printf.sprintf "%d.heap_words" pid), st.Gc.heap_words; (Printf.sprintf "%d.heap_MB" pid), (st.Gc.heap_words * (Sys.word_size / 8) / 1024 / 1024); (Printf.sprintf "%d.minor_words" pid), (int_of_float st.Gc.minor_words); ] let maybe_emit ~now ~pid () = let must_emit_gc_ = now -. Atomic.get last_gc > !gc_interval_us && (* NOTE: this is evaluated only if the interval condition is true, and it has a side effect (setting "emitting_gc" to true). Once we reach this point we must cleanup afterwards. *) not (Atomic.exchange emitting_gc true) in if must_emit_gc_ then ( Atomic.set last_gc now; emit_gc_ ~pid (); Atomic.set emitting_gc false; )
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>