tiny.profiling.driver.progress
Defined in driver.
API (6)
Actions
Public operations.
writeCaptureCaveatswriteCaptureControlProgresswriteCounterProgresswriteInterleaveProgresswriteMeasureProgresswriteWarmupProgress
Source
Source: src/profiling/driver/progress.zig
zig
const std = @import("std");const pretty_usage = @import("pretty_usage");const host = @import("../root.zig").host;const order = @import("../root.zig").order;const perturbation = @import("../root.zig").perturbation;pub fn writeCaptureControlProgress( allocator: std.mem.Allocator, workload_name: []const u8, pair: perturbation.Pair, pair_count: usize,) !void { const order_label = switch (pair.order) { .control_first => "control->capture", .capture_first => "capture->control", }; try pretty_usage.Terminal.stderr(allocator, .{}).writeTextFmt( "profile: {s} capture control pair {d}/{d}, order {s}\n", .{ workload_name, pair.index, pair_count, order_label }, );}pub fn writeMeasureProgress( allocator: std.mem.Allocator, workload_name: []const u8, repeat_index: usize, repeat: u32,) !void { if (repeat <= 1) return; try pretty_usage.Terminal.stderr(allocator, .{}).writeTextFmt( "profile: {s} measurement repetition {d}/{d}\n", .{ workload_name, repeat_index + 1, repeat }, );}pub fn writeInterleaveProgress( allocator: std.mem.Allocator, workload_name: []const u8, entry: order.Entry, acquisition_count: usize, repeat_count: u32,) !void { std.debug.assert(entry.position > 0); std.debug.assert(entry.position <= acquisition_count); try pretty_usage.Terminal.stderr(allocator, .{}).writeTextFmt( "profile: acquisition {d}/{d}, {s} repetition {d}/{d}\n", .{ entry.position, acquisition_count, workload_name, entry.repetition_index + 1, repeat_count, }, );}pub fn writeWarmupProgress( allocator: std.mem.Allocator, workload_name: []const u8, index: usize, repeat: u32,) !void { std.debug.assert(repeat > 0); try pretty_usage.Terminal.stderr(allocator, .{}).writeTextFmt( "profile: {s} unmeasured warmup {d}/{d}\n", .{ workload_name, index + 1, repeat }, );}pub fn writeCounterProgress( allocator: std.mem.Allocator, workload_name: []const u8, lane: host.counters.Lane, options: host.counters.Options, run: host.counters.Run, run_index: usize,) !void { const terminal = pretty_usage.Terminal.stderr(allocator, .{}); if (lane.event_groups.len > 1 and options.repeat > 1) { try terminal.writeTextFmt( "profile: {s} counter execution {d}/{d}, group {d}/{d}, repetition {d}/{d}\n", .{ workload_name, run_index + 1, lane.runs.len, run.group_index, lane.event_groups.len, run.repetition_index, options.repeat, }, ); } else if (lane.event_groups.len > 1) { try terminal.writeTextFmt( "profile: {s} counter group {d}/{d}\n", .{ workload_name, run.group_index, lane.event_groups.len }, ); } else if (options.repeat > 1) { try terminal.writeTextFmt( "profile: {s} counter repetition {d}/{d}\n", .{ workload_name, run.repetition_index, options.repeat }, ); }}pub fn writeCaptureCaveats( allocator: std.mem.Allocator, workload_name: []const u8, captures: []const host.Capture,) !void { const terminal = pretty_usage.Terminal.stderr(allocator, .{}); for (captures) |row| { if (!captureNeedsNotice(row)) continue; try terminal.writeTextFmt( "profile: {s} {s} {s}", .{ workload_name, row.kind, row.state }, ); if (row.caveat_kind) |caveat| { try terminal.writeTextFmt(": {s}", .{caveat}); } if (row.caveat_message) |message| { try terminal.writeTextFmt(": {s}", .{message}); } try terminal.writeText("\n"); }}fn captureNeedsNotice(row: host.Capture) bool { return !std.mem.eql(u8, row.state, "summary_written") or row.caveat_kind != null;}test "profiling driver notices unsupported captures" { try std.testing.expect(!captureNeedsNotice(.{ .kind = "perf_record", .tool = "perf", .capture_path = "perf.data", .summary_path = "perf.summary.json", .state = "summary_written", })); try std.testing.expect(captureNeedsNotice(.{ .kind = "perf_record", .tool = "perf", .capture_path = "perf.data", .summary_path = "perf.summary.json", .state = "insufficient_samples", }));}Source: src/profiling/driver/root.zig:9
zig
pub const progress = @import("progress.zig");Audit
| Definitions | 7 |
|---|---|
| Public names | 7 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |