Skip to documentation
SLOP

tiny.profiling.host

Reference tiny.profiling host

Defined in tiny.profiling.

API (29)

Actions

Public operations.

Types and contracts

Public types and contracts.

Namespaces

Public namespaces.

Values and defaults

Public values and defaults.

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

Source

Source: src/profiling/host/runtime.zig:113

zig
pub const Capture = struct {    kind: []const u8,    tool: []const u8,    tool_version: ?[]const u8 = null,    scope: []const u8 = scope,    capture_path: []const u8,    summary_path: []const u8,    state: []const u8,    caveat_kind: ?[]const u8 = null,    caveat_message: ?[]const u8 = null,};

Source: src/profiling/host/runtime.zig:130

zig
pub const Lane = union(enum) {    counters: counters.Lane,    sampling: sampling.Lane,    dhat: dhat.Lane,    offcpu: offcpu.Lane,    coverage: coverage.Lane,};

Source: src/profiling/host/runtime.zig:27

zig
pub const Options = struct {    counters: ?counters.Options = null,    sampling: ?sampling.Options = null,    dhat: ?dhat.Options = null,    offcpu: ?offcpu.Options = null,    coverage: ?coverage.Options = null,    pub fn validate(self: Options) !void {        var enabled: usize = 0;        if (self.counters != null) enabled += 1;        if (self.sampling != null) enabled += 1;        if (self.dhat != null) enabled += 1;        if (self.offcpu != null) enabled += 1;        if (self.coverage != null) enabled += 1;        if (enabled > 1) return error.ConflictingHostProfilers;        if (self.counters) |options| try options.validate();        if (self.sampling) |options| try options.validate();    }    pub fn any(self: Options) bool {        return self.counters != null or self.sampling != null or self.dhat != null or self.offcpu != null or self.coverage != null;    }    pub fn requiresDirect(self: Options) bool {        return self.dhat != null or self.offcpu != null or self.coverage != null;    }    pub fn tool(self: Options) ?[]const u8 {        if (self.counters != null) return counters.tool;        if (self.sampling != null) return sampling.tool;        if (self.dhat != null) return dhat.tool;        if (self.offcpu) |options| return options.toolName();        if (self.coverage != null) return coverage.tool;        return null;    }    pub fn kind(self: Options) ?[]const u8 {        if (self.counters != null) return counters.kind;        if (self.sampling != null) return sampling.kind;        if (self.dhat != null) return dhat.kind;        if (self.offcpu != null) return offcpu.kind;        if (self.coverage != null) return coverage.kind;        return null;    }    pub fn probeRequest(        self: Options,        allocator: std.mem.Allocator,    ) !?ProbeRequest {        if (self.counters != null or            self.sampling != null or            self.dhat != null or            self.coverage != null)        {            return .{                .argv = try allocator.dupe(                    []const u8,                    &.{ self.tool().?, "--version" },                ),                .version_output = true,            };        }        if (self.offcpu) |options| {            const probe_flag = switch (options.mode) {                .time => "-h",                .stacks => "--version",            };            return .{                .argv = try allocator.dupe(                    []const u8,                    &.{ options.toolName(), probe_flag },                ),                .version_output = options.mode == .stacks,            };        }        return null;    }    pub fn buildArgs(self: Options) []const []const u8 {        if (self.dhat != null and builtin.cpu.arch == .x86_64) {            return &.{"-Dcpu=x86_64_v3"};        }        return &.{};    }};

Source: src/profiling/host/runtime.zig:17

zig
pub const ProbeRequest = struct {    argv: []const []const u8,    version_output: bool,};

Source: src/profiling/host/runtime.zig:22

zig
pub const ToolProbe = struct {    available: bool = false,    version: ?[]const u8 = null,};

Source: src/profiling/host/runtime.zig:125

zig
pub const Wrapped = struct {    argv: []const []const u8,    lane: ?Lane = null,};
Called byCallsNo direct callershost.Optionstoolhost.OptionsprobeRequest
Static calls · unresolved targets: 0 · external targets: 2.
Called byCallsNo direct callshost.OptionsprobeRequesthost.Optionstool
Static calls · unresolved targets: 0 · external targets: 1.

Source: src/profiling/host/runtime.zig:13

zig
pub const direct_scope = "workload-binary";

Source: src/profiling/host/runtime.zig:300

zig
pub fn missingBinary(    allocator: std.mem.Allocator,    options: Options,    workload_root: []const u8,    tool_probe: ToolProbe,) ![]const Capture {    const lane = try descriptor(allocator, options, workload_root) orelse return &.{};    const rows = try allocator.alloc(Capture, 1);    rows[0] = .{        .kind = lane.kind,        .tool = lane.tool,        .tool_version = tool_probe.version,        .capture_path = lane.capture_path,        .summary_path = lane.summary_path,        .state = "binary_missing",        .caveat_kind = "no_direct_binary",        .caveat_message = "workload declares no benchmark binary in the catalog; direct-binary evidence needs bin metadata",    };    return rows;}
Called byCallsNo direct callersprivate; no linksrc.profiling.host.runtimedescriptorhostmissingBinary
Static calls · unresolved targets: 0 · external targets: 1.

Source: src/profiling/host/runtime.zig:365

zig
pub fn probe(    allocator: std.mem.Allocator,    process_io: std.Io,    request: ProbeRequest,) !ToolProbe {    const result = sys.process.run(allocator, process_io, .{        .argv = request.argv,        .stdout_limit = .limited(max_probe_output_bytes),        .stderr_limit = .limited(max_probe_output_bytes),    }) catch |err| switch (err) {        error.OutOfMemory => return err,        else => return .{},    };    defer allocator.free(result.stdout);    defer allocator.free(result.stderr);    if (sys.process.exitCode(result.term) != 0) return .{};    return .{        .available = true,        .version = if (request.version_output)            try probeVersion(allocator, result.stdout, result.stderr)        else            null,    };}
Called byCallsNo direct callersprivate; no linksrc.profiling.host.runtimeprobeVersionhostprobe
Static calls · unresolved targets: 1 · external targets: 2.

Source: src/profiling/host/runtime.zig:174

zig
pub fn resetCaptureArtifacts(wrapped: Wrapped) !void {    const lane = wrapped.lane orelse return;    switch (lane) {        .counters => |value| {            try deleteFileIfPresent(value.csv_path);            for (value.runs) |run| try deleteFileIfPresent(run.csv_path);            for (value.repetition_csv_paths) |path| try deleteFileIfPresent(path);            for (value.event_groups) |group| try deleteFileIfPresent(group.csv_path);        },        .sampling => |value| try deleteFileIfPresent(value.data_path),        .dhat => |value| {            try deleteFileIfPresent(value.capture_path);            try deleteFileIfPresent(value.out_path);        },        .offcpu => |value| {            try deleteFileIfPresent(value.capture_path);            try deleteFileIfPresent(value.diagnostics_path);        },        .coverage => |value| try sys.fs.deleteTree(value.directory_path),    }}
Called byCallsNo direct callersprivate; no linksrc.profiling.host.runtimedeleteFileIfPresenthostresetCaptureArtifacts
Static calls · unresolved targets: 0 · external targets: 1.

Source: src/profiling/host/runtime.zig:12

zig
pub const scope = "whole-step";

Source: src/profiling/host/runtime.zig:321

zig
pub fn setupFailed(    allocator: std.mem.Allocator,    options: Options,    workload_root: []const u8,    tool_probe: ToolProbe,) ![]const Capture {    const lane = try descriptor(allocator, options, workload_root) orelse return &.{};    const rows = try allocator.alloc(Capture, 1);    rows[0] = .{        .kind = lane.kind,        .tool = lane.tool,        .tool_version = tool_probe.version,        .scope = direct_scope,        .capture_path = lane.capture_path,        .summary_path = lane.summary_path,        .state = "setup_failed",        .caveat_kind = "workload_build_failed",        .caveat_message = "the benchmark binary failed to build; inspect setup stderr before interpreting missing evidence",    };    return rows;}
Called byCallsNo direct callersprivate; no linksrc.profiling.host.runtimedescriptorhostsetupFailed
Static calls · unresolved targets: 0 · external targets: 1.

Source: src/profiling/host/runtime.zig:210

zig
pub fn summarize(    allocator: std.mem.Allocator,    process_io: std.Io,    wrapped: Wrapped,    exit_code: i64,    stderr_path: []const u8,    tool_probe: ToolProbe,    scope_label: []const u8,    workload_name: []const u8,    max_benchmark_allocated_bytes: ?u64,) ![]const Capture {    const lane = wrapped.lane orelse return &.{};    var row = switch (lane) {        .counters => |value| try counters.summarize(            allocator,            value,            exit_code,            stderr_path,            tool_probe.available,        ),        .sampling => |value| try sampling.summarize(            allocator,            process_io,            value,            exit_code,            stderr_path,            tool_probe.available,        ),        .dhat => |value| try dhat.summarize(            allocator,            value,            exit_code,            stderr_path,            tool_probe.available,            max_benchmark_allocated_bytes,        ),        .offcpu => |value| try offcpu.summarize(            allocator,            value,            exit_code,            stderr_path,            tool_probe.available,        ),        .coverage => |value| try coverage.summarize(            allocator,            value,            exit_code,            stderr_path,            tool_probe.available,            workload_name,        ),    };    row.tool_version = tool_probe.version;    row.scope = scope_label;    const rows = try allocator.alloc(Capture, 1);    rows[0] = row;    return rows;}
Called byCallsNo direct callershost.counterssummarizehost.coveragesummarizehost.dhatsummarizehost.offcpusummarizehost.samplingsummarizehostsummarize
Static calls · unresolved targets: 0 · external targets: 1.

Source: src/profiling/host/runtime.zig:343

zig
pub fn warmupFailed(    allocator: std.mem.Allocator,    options: Options,    workload_root: []const u8,    tool_probe: ToolProbe,) ![]const Capture {    const lane = try descriptor(allocator, options, workload_root) orelse return &.{};    const rows = try allocator.alloc(Capture, 1);    rows[0] = .{        .kind = lane.kind,        .tool = lane.tool,        .tool_version = tool_probe.version,        .scope = direct_scope,        .capture_path = lane.capture_path,        .summary_path = lane.summary_path,        .state = "warmup_failed",        .caveat_kind = "workload_warmup_failed",        .caveat_message = "an unmeasured warmup failed; measurement and profiler capture were suppressed",    };    return rows;}
Called byCallsNo direct callersprivate; no linksrc.profiling.host.runtimedescriptorhostwarmupFailed
Static calls · unresolved targets: 0 · external targets: 1.

Source: src/profiling/host/runtime.zig:138

zig
pub fn wrap(    allocator: std.mem.Allocator,    options: Options,    argv: []const []const u8,    workload_root: []const u8,    tool_available: bool,) !Wrapped {    try options.validate();    if (options.counters) |lane_options| {        const lane = try counters.plan(allocator, lane_options, workload_root);        if (!tool_available) return .{ .argv = argv, .lane = .{ .counters = lane } };        return .{ .argv = try counters.wrapArgv(allocator, lane_options, argv, lane), .lane = .{ .counters = lane } };    }    if (options.sampling) |lane_options| {        const lane = try sampling.plan(allocator, lane_options, workload_root);        if (!tool_available) return .{ .argv = argv, .lane = .{ .sampling = lane } };        return .{ .argv = try sampling.wrapArgv(allocator, lane_options, argv, lane), .lane = .{ .sampling = lane } };    }    if (options.dhat) |lane_options| {        const lane = try dhat.plan(allocator, lane_options, workload_root);        if (!tool_available) return .{ .argv = argv, .lane = .{ .dhat = lane } };        return .{ .argv = try dhat.wrapArgv(allocator, lane_options, argv, lane), .lane = .{ .dhat = lane } };    }    if (options.offcpu) |lane_options| {        const lane = try offcpu.plan(allocator, lane_options, workload_root);        if (!tool_available) return .{ .argv = argv, .lane = .{ .offcpu = lane } };        return .{ .argv = try offcpu.wrapArgv(allocator, lane_options, argv, lane), .lane = .{ .offcpu = lane } };    }    if (options.coverage) |lane_options| {        const lane = try coverage.plan(allocator, lane_options, workload_root);        if (!tool_available) return .{ .argv = argv, .lane = .{ .coverage = lane } };        return .{ .argv = try coverage.wrapArgv(allocator, lane_options, argv, lane), .lane = .{ .coverage = lane } };    }    return .{ .argv = argv };}
Called byCallsNo direct callershost.countersplanhost.counterswrapArgvhost.coveragewrapArgvhost.dhatplanhost.dhatwrapArgv+4 morehostwrap
Static calls · unresolved targets: 0 · external targets: 2.

Source: src/profiling/host/root.zig

zig
const runtime = @import("runtime.zig");pub const counters = runtime.counters;pub const coverage = runtime.coverage;pub const dhat = runtime.dhat;pub const offcpu = runtime.offcpu;pub const process = runtime.process;pub const sampling = runtime.sampling;pub const state = @import("state.zig");pub const scope = runtime.scope;pub const direct_scope = runtime.direct_scope;pub const ProbeRequest = runtime.ProbeRequest;pub const ToolProbe = runtime.ToolProbe;pub const Options = runtime.Options;pub const Capture = runtime.Capture;pub const Wrapped = runtime.Wrapped;pub const Lane = runtime.Lane;pub const wrap = runtime.wrap;pub const resetCaptureArtifacts = runtime.resetCaptureArtifacts;pub const summarize = runtime.summarize;pub const missingBinary = runtime.missingBinary;pub const setupFailed = runtime.setupFailed;pub const warmupFailed = runtime.warmupFailed;pub const probe = runtime.probe;

Source: src/profiling/root.zig:26

zig
pub const host = @import("host/root.zig");

Complete call list for host.wrap

9 direct calls.

Audit

Definitions23
Public names23
Members25
Version26.7.0
Revisiondaab053ee433