package catapult
Tracing system based on the Catapult/TEF format
Install
dune-project
Dependency
Authors
Maintainers
Sources
v0.1.1.tar.gz
md5=b706c74e8644967431055dc61f611f37
sha512=2915460b9fdd8a470de1b3bc75fcf58c36d00823588f46082db5099979f96f3bc261a91d4b5c672d2df9493461075fd61df804c1e4e737ee052af280dc6c9a6b
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)"
>