Skip to documentation
SLOP

tiny.profiling.driver.environment

Reference tiny.profiling driver environment

Defined in driver.

API (3)

Actions

Public operations.

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

Source

Called byCallsNo direct callsdriver.acquirerunChildAcquisitiondriver.acquirerunResettest; no linksrc.profiling.driver.environmenttest: profiling driver preserves inhe...private; no linksrc.profiling.driver.preparerunPreparedriver.preparerunWarmupstest; no linksrc.profiling.driver.testtest: profiling driver setup and prep...driver.environmenteffectiveChildEnvironment
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest; no linksrc.profiling.driver.environmenttest: profiling driver warmups preser...driver.preparerunWarmupsdriver.environmentwarmupBenchControl
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsdriver.acquirerunChildAcquisitiontest; no linksrc.profiling.driver.environmenttest: profiling driver composes catal...driver.preparerunWarmupsdriver.environmentworkloadBenchControl
Static calls · unresolved targets: 0 · external targets: 0.

Source: src/profiling/driver/environment.zig

zig
const std = @import("std");const sys = @import("sys");const catalog = @import("../root.zig").catalog;const execute = @import("../root.zig").execute;const PreparedWorkload = @import("root.zig").model.PreparedWorkload;const WorkloadContext = @import("root.zig").model.WorkloadContext;const makeResetTestPaths = @import("fixture/root.zig").makeResetTestPaths;const resetTestContext = @import("fixture/root.zig").resetTestContext;const resetTestPrepared = @import("fixture/root.zig").resetTestPrepared;const resetTestWorkload = @import("fixture/root.zig").resetTestWorkload;pub fn effectiveChildEnvironment(    context: *const WorkloadContext,    prepared: *const PreparedWorkload,) ?*const sys.process.Environ.Map {    if (prepared.child_environment) |*environment| {        std.debug.assert(prepared.execution_plan.direct);        return environment;    }    return context.environ_map;}pub fn warmupBenchControl(control: execute.BenchControl) execute.BenchControl {    return .{        .min_time_ns = control.min_time_ns,        .filter = control.filter,    };}pub fn workloadBenchControl(    control: execute.BenchControl,    environment: []const catalog.EnvironmentOverride,) execute.BenchControl {    if (control.filter != null) return control;    var result = control;    for (environment) |entry| {        if (std.mem.eql(u8, entry.name, "BENCH_FILTER")) {            result.filter = entry.value;            break;        }    }    return result;}test "profiling driver warmups preserve workload controls but disable causal experiments" {    const control = warmupBenchControl(.{        .causal = true,        .min_time_ns = 30 * std.time.ns_per_s,        .filter = "small alloc",    });    try std.testing.expect(!control.causal);    try std.testing.expectEqual(@as(?u64, 30 * std.time.ns_per_s), control.min_time_ns);    try std.testing.expectEqualStrings("small alloc", control.filter.?);}test "profiling driver composes catalog and CLI benchmark filters" {    const environment = [_]catalog.EnvironmentOverride{        .{ .name = "HOME", .value = "/fixture" },        .{ .name = "BENCH_FILTER", .value = "catalog lane" },    };    const catalog_control = workloadBenchControl(.{}, &environment);    try std.testing.expectEqualStrings("catalog lane", catalog_control.filter.?);    const cli_control = workloadBenchControl(.{ .filter = "CLI lane" }, &environment);    try std.testing.expectEqualStrings("CLI lane", cli_control.filter.?);    try std.testing.expectEqualStrings("/fixture", environment[0].value.?);    try std.testing.expect(workloadBenchControl(.{}, environment[0..1]).filter == null);}test "profiling driver preserves inherited environment without child overrides" {    var tmp = std.testing.tmpDir(.{});    defer tmp.cleanup();    var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);    defer arena_state.deinit();    const allocator = arena_state.allocator();    const root = try tmp.parent_dir.realPathFileAlloc(        std.testing.io,        tmp.sub_path[0..],        allocator,    );    const paths = try makeResetTestPaths(allocator, root);    var base_environment = sys.process.Environ.Map.init(allocator);    try base_environment.put("PATH", "/usr/bin:/bin");    const environment = [_]catalog.EnvironmentOverride{.{        .name = "HOME",        .value = root,    }};    const workload = resetTestWorkload(&.{"/bin/true"}, &environment);    var prepared = try resetTestPrepared(        allocator,        &base_environment,        workload,        paths.workload,        &.{"/bin/true"},    );    var context = resetTestContext(allocator, &base_environment, paths.run, 0, 1);    try std.testing.expectEqualStrings(        root,        effectiveChildEnvironment(&context, &prepared).?.get("HOME").?,    );    prepared.child_environment = null;    try std.testing.expectEqualStrings(        "/usr/bin:/bin",        effectiveChildEnvironment(&context, &prepared).?.get("PATH").?,    );    context.environ_map = null;    try std.testing.expect(effectiveChildEnvironment(&context, &prepared) == null);}

Source: src/profiling/driver/root.zig:4

zig
pub const environment = @import("environment.zig");

Audit

Definitions4
Public names4
Members0
Version26.7.0
Revisiondaab053ee433