Skip to documentation
SLOP

tiny.bench.CozSession

Reference tiny.bench CozSession

Defined in tiny.bench.

API (9)

Actions

Public operations.

Fields and members

Public fields and members.

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

Source

Source: lib/bench/src/instrumentation.zig:12

zig
pub const CozSession = struct {    runtime: coz.Runtime = .{},    profile_file: coz.ProfileFile = .{},    enabled: bool = false,    pub fn start(self: *CozSession, alloc: Allocator) !void {        try self.startWithOptions(alloc, .{});    }    pub fn startWithOptions(self: *CozSession, alloc: Allocator, options: coz.RuntimeOptions) !void {        self.enabled = try self.runtime.startIfAvailable(alloc, options);    }    pub fn startWithOutputPath(self: *CozSession, alloc: Allocator, path: []const u8) !void {        try self.startWithOutputPathAndOptions(alloc, path, .{});    }    pub fn startWithOutputPathAndOptions(        self: *CozSession,        alloc: Allocator,        path: []const u8,        options: coz.RuntimeOptions,    ) !void {        try self.profile_file.open(path);        errdefer self.profile_file.close();        var runtime_options = options;        runtime_options.profile_writer = self.profile_file.interface().?;        self.enabled = try self.runtime.startIfAvailable(alloc, runtime_options);        if (!self.enabled) self.profile_file.close();    }    pub fn deinit(self: *CozSession) void {        self.runtime.shutdown();        self.profile_file.close();        self.enabled = false;    }    pub fn finish(self: *CozSession) !void {        var first_error: ?anyerror = null;        self.runtime.stop() catch |err| rememberSessionError(&first_error, err);        self.profile_file.finish() catch |err| rememberSessionError(&first_error, err);        self.enabled = false;        if (first_error) |err| return err;    }};

Source: lib/bench/src/root.zig:42

zig
pub const CozSession = instrumentation.CozSession;
Called byCallsNo direct callsProfilingSessiondeinittest sourcelib.bench.src.instrumentationtest: coz session starts without samp...test sourcelib.bench.src.instrumentationtest: coz session writes owned profil...SuiterunSilentSuiterunWithOptionsCozSessiondeinit
Static calls · unresolved targets: 1 · external targets: 1.
Called byCallsProfilingSessionfinishprivate sourcelib.bench.src.instrumentationrememberSessionErrorCozSessionfinish
Static calls · unresolved targets: 0 · external targets: 2.
Called byCallsNo direct callersCozSessionstartWithOptionsCozSessionstart
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsCozSessionstarttest sourcelib.bench.src.instrumentationtest: coz session rejects invalid sam...test sourcelib.bench.src.instrumentationtest: coz session starts without samp...CozSessionstartWithOptions
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsProfilingSessionstartCozSessionstartWithOutputPathAndOptionsCozSessionstartWithOutputPath
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsCozSessionstartWithOutputPathtest sourcelib.bench.src.instrumentationtest: coz session writes owned profil...CozSessionstartWithOutputPathAndOptions
Static calls · unresolved targets: 1 · external targets: 3.

Audit

Definitions7
Public names7
Members3
Version26.7.0
Revisiondaab053ee433