Skip to documentation
SLOP

tiny.memtrace.IntervalSink

Reference tiny.memtrace IntervalSink

Defined in context.

A pair of borrowed callbacks that report the beginning and the end of a phase, identified by a category byte.

API (6)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

No direct callersNo direct callscontextIntervalSink
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/memtrace/src/context.zig:24

zig
/// A pair of borrowed callbacks that report the beginning and the end of a/// phase, identified by a category byte. A caller with its own profiler uses/// them to report memtrace's phase boundaries into that profiler. `begin` takes/// the category and answers with a token, `end` takes that token back, and/// neither call can fail. The owner keeps `context` alive for as long as the/// sink is in use, because both callbacks receive it unchanged. A token is/// closed from the thread that opened it, before any token opened after it,/// which is the order `Context.enterInterval` and `IntervalSpan.exit` produce/// when the spans nest lexically. The callbacks carry no synchronization of/// their own, so one thread at a time uses a sink. `begin` answers with/// `invalid_token` to decline a span, and the matching exit then calls nothing.pub const IntervalSink = struct {    pub const invalid_token = std.math.maxInt(u16);    context: *anyopaque,    begin_fn: *const fn (*anyopaque, u8) u16,    end_fn: *const fn (*anyopaque, u16) void,    pub fn begin(self: IntervalSink, category: u8) u16 {        return self.begin_fn(self.context, category);    }    pub fn end(self: IntervalSink, token: u16) void {        self.end_fn(self.context, token);    }};

Source: lib/memtrace/src/root.zig:56

zig
pub const IntervalSink = context_mod.IntervalSink;

Audit

Definitions4
Public names8
Members3
Version26.7.0
Revisiondaab053ee433