模組 Runtime_events.Callbacks

module Callbacks: sig .. end

type t 

回呼函式的類型。

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

建立一個 Callback,它可以選擇訂閱一個或多個執行時期事件。回呼函式的第一個整數參數是環狀緩衝區的索引。每個領域(domain)在其存在的期間都擁有一個單一的環狀緩衝區。在領域終止後,新產生的領域可能會取得該環狀緩衝區的所有權。runtime_begin 回呼函式會在執行時期進入一個新階段時被呼叫(例如,在次要 GC 開始時會呼叫一個帶有 EV_MINOR 的 runtime_begin)。runtime_end 回呼函式會在執行時期離開特定階段時被呼叫。runtime_counter 回呼函式會在執行時期發出計數器時被呼叫。lifecycle 回呼函式會在環狀緩衝區的生命週期發生變更時被呼叫,而消費者可能需要做出回應。alloc 回呼函式目前僅在儀器化的執行時期被呼叫。lost_events 回呼函式會在消費者程式碼偵測到一些未消耗的事件已被覆寫時被呼叫。

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 擴展 t 以額外訂閱類型為 ty 的使用者事件。當此類事件發生時,將使用相應的事件和酬載呼叫 callback