package catapult
Tracing system based on the Catapult/TEF format
Install
Dune Dependency
Authors
Maintainers
Sources
v0.2.tar.gz
md5=c732cce9430be74e8136cf87d6d8f9e5
sha512=2c221b86950a5ef81a41358b929633acc9d2b600aef8192a2b978b3b16dfc6237c79457db39f3beb95750d732674c977bc0547dde75bdfdf2fb378d192d37c48
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
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)"
>