Runtime_events.Callbacks(3) OCaml library Runtime_events.Callbacks(3)

Runtime_events.Callbacks - no description

Module Runtime_events.Callbacks

Module Callbacks
: sig end

type t

Type of callbacks

val create : ?runtime_begin:(int -> Runtime_events.Timestamp.t -> Runtime_events.runtime_phase -> unit) -> ?runtime_end:(int -> Runtime_events.Timestamp.t -> Runtime_events.runtime_phase -> unit) -> ?runtime_counter:(int -> Runtime_events.Timestamp.t -> Runtime_events.runtime_counter -> int -> unit) -> ?alloc:(int -> Runtime_events.Timestamp.t -> int array -> unit) -> ?lifecycle:(int -> Runtime_events.Timestamp.t -> Runtime_events.lifecycle -> int option -> unit) -> ?lost_events:(int -> int -> unit) -> unit -> t

Create a Callback that optionally subscribes to one or more runtime events. The first int supplied to callbacks is the ring buffer index. Each domain owns a single ring buffer for the duration of the domain's existence. After a domain terminates, a newly spawned domain may take ownership of the ring buffer. A runtime_begin callback is called when the runtime enters a new phase (e.g a runtime_begin with EV_MINOR is called at the start of a minor GC). A runtime_end callback is called when the runtime leaves a certain phase. The runtime_counter callback is called when a counter is emitted by the runtime. lifecycle callbacks are called when the ring undergoes a change in lifecycle and a consumer may need to respond. alloc callbacks are currently only called on the instrumented runtime. lost_events callbacks are called if the consumer code detects some unconsumed events have been overwritten.

val add_user_event : 'a Runtime_events.Type.t -> (int -> Runtime_events.Timestamp.t -> 'a Runtime_events.User.t -> 'a -> unit) -> t -> t

add_user_event ty callback t extends t to additionally subscribe to user events of type ty . When such an event happens, callback is called with the corresponding event and payload.

2024-02-29 OCamldoc