package pyro-caml-instruments
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=22cc6fd089dd4ecb8cb41581d3d109e3
sha512=9c5fd425c5981e31dbcdcbaef6f8f462f749d165df08e1686ec2e44872dca590b5a137d3aea76b2799de7f0eb5615fe03823bdf290bde68100dfa931260a40e5
doc/pyro-caml-instruments/Pyro_caml_instruments/index.html
Module Pyro_caml_instrumentsSource
with_memprof_sampler ?sampling_rate f enables the Pyro Caml sampler for the duration of f. An optional sampling_rate can be passed which will be given to the underlying Gc.Memprof profiler. By default it is 1e-6, but choose a higher value such as 1e-4 if there the profiler sample rate is high, or not many allocations happen in your program. Alternatively if not many allocations happen, use emit_point_event or the Pyro Caml PPX
maybe_with_memprof_sampler ?sampling_rate f is similar to with_memprof_sampler except it only enables the sampler if the env var OCAML_RUNTIME_EVENTS_START is set
emit_point_event (Printexc.get_callstack max_int) will record a stack trace to the profiler. This is useful if you are in code that might not allocate much and you want to ensure you're still generating enough sample points.
create_cursor path pid creates a cursor for reading runtime events from the given path and pid.
val read_poll :
?max_events:int option ->
Runtime_events.cursor ->
float ->
Pyro_caml_instruments__.Stack_trace.t listread_poll cursor sample_interval will read the profiling runtime events from the given cursor, and will give attempt to give a single Stack_trace.t per every unique thread id, within sample_interval of the start time of this function call. If a sample is not within this interval, it will not be considered. Additionally it also ensures the samples chosen are those closest to the start of the call of this function.