tiny.profiling.driver.measure
Defined in driver.
API (1)
Actions
Public operations.
Source
Source: src/profiling/driver/measure.zig
zig
const std = @import("std");const catalog = @import("../root.zig").catalog;const execute = @import("../root.zig").execute;const host = @import("../root.zig").host;const record = @import("../root.zig").record;const MeasuredWorkload = @import("root.zig").model.MeasuredWorkload;const PreparedWorkload = @import("root.zig").model.PreparedWorkload;const WorkloadContext = @import("root.zig").model.WorkloadContext;const absoluteArtifactEnv = @import("root.zig").paths.absoluteArtifactEnv;const absoluteExecutionArtifactEnv = @import("root.zig").paths.absoluteExecutionArtifactEnv;const aggregateMeasuredCommand = @import("root.zig").acquire.aggregateMeasuredCommand;const runCaptureControlPlan = @import("root.zig").control.runCaptureControlPlan;const runMeasuredCommand = @import("root.zig").acquire.runMeasuredCommand;const writeCounterProgress = @import("root.zig").progress.writeCounterProgress;const writeMeasureProgress = @import("root.zig").progress.writeMeasureProgress;pub fn runMeasuredWorkload( allocator: std.mem.Allocator, context: *const WorkloadContext, workload: catalog.Workload, prepared: PreparedWorkload, resets: *std.ArrayList(record.Reset),) !MeasuredWorkload { const counter_options = context.request.host_lanes.counters; const counter_lane = if (prepared.wrapped.lane) |lane| switch (lane) { .counters => |value| value, else => null, } else null; if (context.request.capture_control.enabled()) { const capture_env = try absoluteArtifactEnv(allocator, prepared.paths); return try runCaptureControlPlan( allocator, context, workload, prepared, capture_env, resets, ); } if (!context.tool_probe.available or counter_options == null or counter_lane == null) { var aggregate: ?execute.Result = null; var executions: std.ArrayList(record.MeasuredExecution) = .empty; var host_state_windows: std.ArrayList(host.state.Window) = .empty; var reset_failed = false; for (0..context.request.measure_repeat) |repeat_index| { if (context.progress_output == .terminal) { try writeMeasureProgress( allocator, workload.name, repeat_index, context.request.measure_repeat, ); } const execution_paths = try record.executionPaths( allocator, prepared.paths, context.request.measure_repeat, repeat_index + 1, ); const artifacts = try absoluteExecutionArtifactEnv( allocator, execution_paths, ); const measurement = try runMeasuredCommand( allocator, context, workload, prepared, prepared.wrapped.argv, artifacts, .measurement, .measurement, repeat_index + 1, resets, ); const result = measurement.execution; if (measurement.measured) { try executions.append(allocator, .{ .index = repeat_index + 1, .result = result, .paths = execution_paths, }); } else { reset_failed = true; } if (measurement.host_state) |window| { try host_state_windows.append(allocator, window); } aggregate = aggregateMeasuredCommand(aggregate, measurement); if (result.exit_code != 0) break; } return .{ .aggregate = aggregate.?, .executions = try executions.toOwnedSlice(allocator), .host_state_windows = try host_state_windows.toOwnedSlice(allocator), .reset_failed = reset_failed, }; } const options = counter_options.?; const lane = counter_lane.?; std.debug.assert(lane.runs.len == lane.event_groups.len * options.repeat); var aggregate: ?execute.Result = null; var executions: std.ArrayList(record.MeasuredExecution) = .empty; var host_state_windows: std.ArrayList(host.state.Window) = .empty; var reset_failed = false; for (lane.runs, 0..) |run, run_index| { if (context.progress_output == .terminal) { try writeCounterProgress( allocator, workload.name, lane, options, run, run_index, ); } const argv = if (run_index == 0) prepared.wrapped.argv else try host.counters.wrapRunArgv( allocator, options, prepared.execution_plan.argv, lane, run_index, ); const execution_paths = try record.executionPaths( allocator, prepared.paths, lane.runs.len, run_index + 1, ); const artifacts = try absoluteExecutionArtifactEnv( allocator, execution_paths, ); const measurement = try runMeasuredCommand( allocator, context, workload, prepared, argv, artifacts, .measurement, .counter, run_index + 1, resets, ); const result = measurement.execution; if (measurement.measured) { try executions.append(allocator, .{ .index = run_index + 1, .result = result, .paths = execution_paths, }); } else { reset_failed = true; } if (measurement.host_state) |window| { try host_state_windows.append(allocator, window); } aggregate = aggregateMeasuredCommand(aggregate, measurement); if (result.exit_code != 0) break; } return .{ .aggregate = aggregate.?, .executions = try executions.toOwnedSlice(allocator), .host_state_windows = try host_state_windows.toOwnedSlice(allocator), .reset_failed = reset_failed, };}Source: src/profiling/driver/root.zig:5
zig
pub const measure = @import("measure.zig");Complete call list for driver.measure.runMeasuredWorkload
9 direct calls.
tiny.profiling.driver.acquire.aggregateMeasuredCommand[function] atsrc/profiling/driver/acquire.zig:160tiny.profiling.driver.acquire.runMeasuredCommand[function] atsrc/profiling/driver/acquire.zig:14tiny.profiling.driver.control.runCaptureControlPlan[function] atsrc/profiling/driver/control.zig:18tiny.profiling.driver.paths.absoluteArtifactEnv[function] atsrc/profiling/driver/paths.zig:7tiny.profiling.driver.paths.absoluteExecutionArtifactEnv[function] atsrc/profiling/driver/paths.zig:27tiny.profiling.driver.progress.writeCounterProgress[function] atsrc/profiling/driver/progress.zig:70tiny.profiling.driver.progress.writeMeasureProgress[function] atsrc/profiling/driver/progress.zig:23tiny.profiling.host.counters.wrapRunArgv[function] atsrc/profiling/host/counters.zig:215tiny.profiling.record.executionPaths[function] atsrc/profiling/record.zig:290
Audit
| Definitions | 2 |
|---|---|
| Public names | 2 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |