tiny.bench.CozSession
Defined in tiny.bench.
API (9)
Actions
Public operations.
Fields and members
Public fields and members.
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;Audit
| Definitions | 7 |
|---|---|
| Public names | 7 |
| Members | 3 |
| Version | 26.7.0 |
| Revision | daab053ee433 |