---
name: "Runtime_events.Callbacks"
section: "3o"
platform: "linux"
package: "ocaml"
version: "5.5.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Runtime_events.Callbacks"
---

# Runtime\_events.Callbacks(3o)

no description

## NAME

Runtime\_events.Callbacks - no description

## Module

Module   Runtime\_events.Callbacks

## Documentation

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.
