tiny.profiling.priority
Defined in tiny.profiling.
API (12)
Actions
Public operations.
Types and contracts
Public types and contracts.
Source
Source: src/profiling/priority.zig
zig
const std = @import("std");const catalog = @import("root.zig").catalog;const coz = @import("capture/root.zig").coz;const memory = @import("root.zig").memory;const metric = @import("root.zig").metric;pub const WorkloadSummary = struct { name: []const u8, package: []const u8, step: []const u8, wall_ns: u64, max_rss_kib: ?i64,};pub const WorkloadComparison = struct { workload: []const u8, baseline_wall_ns: u64, candidate_wall_ns: u64, wall_percent_change: f64, baseline_wall_samples: usize = 1, candidate_wall_samples: usize = 1, baseline_wall_distribution: []const u8 = "point_estimate", candidate_wall_distribution: []const u8 = "point_estimate", wall_effect_low_percent: ?f64 = null, wall_effect_high_percent: ?f64 = null, wall_status: []const u8 = "point_regression_candidate", baseline_max_rss_kib: ?i64, candidate_max_rss_kib: ?i64, rss_percent_change: ?f64, wall_threshold_percent: f64, rss_threshold_percent: f64, kind: []const u8,};pub const Unit = enum { ns, kib, bytes, count, pub fn name(self: Unit) []const u8 { return @tagName(self); }};pub const Kind = enum { wall, rss, timing_metric, memory_metric, pub fn name(self: Kind) []const u8 { return @tagName(self); }};pub const Evidence = enum { observed_regression, interval_regression, sample_regression, uncertain_regression, point_regression, memory_regression, allocation_candidate, pub fn name(self: Evidence) []const u8 { return @tagName(self); }};pub const Item = struct { rank: usize = 0, kind: Kind, workload: []const u8, package: []const u8, component: []const u8, label: []const u8, key: []const u8, evidence: Evidence, confidence: f64, workload_weight: f64, percent_change: f64, threshold_percent: f64, absolute_change: f64, unit: Unit, causal_max_program_speedup: ?f64 = null, score: f64, reason: []const u8,};pub const Component = struct { rank: usize = 0, component: []const u8, score: f64, affected_workloads: usize, issue_count: usize, strongest_workload: []const u8, strongest_label: []const u8, strongest_score: f64, reason: []const u8,};pub const Report = struct { items: []const Item = &.{}, components: []const Component = &.{},};const WorkloadInfo = struct { package: []const u8, component: []const u8, weight: f64,};const ComponentBuilder = struct { component: []const u8, score: f64 = 0, issue_count: usize = 0, workloads: std.ArrayList([]const u8) = .empty, strongest_index: usize = 0,};pub fn build( allocator: std.mem.Allocator, workloads: []const WorkloadSummary, runtime: []const WorkloadComparison, timing: []const metric.Comparison, memory_rows: []const memory.Comparison, causal: []const coz.Result,) !Report { var items: std.ArrayList(Item) = .empty; for (runtime) |row| { if (std.mem.indexOf(u8, row.kind, "wall") != null) try appendWallItem(allocator, &items, workloads, row, causal); if (std.mem.indexOf(u8, row.kind, "rss") != null) try appendRssItem(allocator, &items, workloads, row); } for (timing) |row| try appendTimingItem(allocator, &items, workloads, row, causal); for (memory_rows) |row| try appendMemoryItem(allocator, &items, workloads, row); const item_slice = try items.toOwnedSlice(allocator); sortItems(item_slice); for (item_slice, 0..) |*item, index| item.rank = index + 1; const components = try buildComponents(allocator, item_slice); return .{ .items = item_slice, .components = components };}fn appendWallItem( allocator: std.mem.Allocator, items: *std.ArrayList(Item), workloads: []const WorkloadSummary, row: WorkloadComparison, causal: []const coz.Result,) !void { const info = workloadInfo(workloads, row.workload); const absolute = positiveDiffU64(row.baseline_wall_ns, row.candidate_wall_ns); const threshold = row.wall_threshold_percent; const evidence = wallEvidence(row.wall_status); const confidence = confidenceForEvidence(evidence); const causal_support = coz.bestSupportedProgramSpeedup(causal, row.workload); const score = scoreFor(row.wall_percent_change, threshold, absolute, .ns, confidence, info.weight) * causalScale(causal_support); try items.append(allocator, .{ .kind = .wall, .workload = row.workload, .package = info.package, .component = info.component, .label = "mean execution wall time", .key = "mean_execution_wall_ns", .evidence = evidence, .confidence = confidence, .workload_weight = info.weight, .percent_change = row.wall_percent_change, .threshold_percent = threshold, .absolute_change = absolute, .unit = .ns, .causal_max_program_speedup = causal_support, .score = score, .reason = try itemReason(allocator, .wall, evidence, row.wall_percent_change, threshold, absolute, .ns, confidence, info.weight, causal_support), });}fn appendRssItem( allocator: std.mem.Allocator, items: *std.ArrayList(Item), workloads: []const WorkloadSummary, row: WorkloadComparison,) !void { const percent = row.rss_percent_change orelse return; const info = workloadInfo(workloads, row.workload); const absolute = positiveDiffI64(row.baseline_max_rss_kib, row.candidate_max_rss_kib) orelse 0; const threshold = row.rss_threshold_percent; const evidence = Evidence.observed_regression; const confidence = confidenceForEvidence(evidence); const score = scoreFor(percent, threshold, absolute, .kib, confidence, info.weight); try items.append(allocator, .{ .kind = .rss, .workload = row.workload, .package = info.package, .component = info.component, .label = "workload max RSS", .key = "max_rss_kib", .evidence = evidence, .confidence = confidence, .workload_weight = info.weight, .percent_change = percent, .threshold_percent = threshold, .absolute_change = absolute, .unit = .kib, .score = score, .reason = try itemReason(allocator, .rss, evidence, percent, threshold, absolute, .kib, confidence, info.weight, null), });}fn appendTimingItem( allocator: std.mem.Allocator, items: *std.ArrayList(Item), workloads: []const WorkloadSummary, row: metric.Comparison, causal: []const coz.Result,) !void { const info = workloadInfo(workloads, row.workload); const evidence = timingEvidence(row.status); const confidence = confidenceForEvidence(evidence); const absolute = @max(row.candidate_ns - row.baseline_ns, 0); const causal_support = coz.bestSupportedProgramSpeedup(causal, row.workload); const score = scoreFor(row.percent_change, row.threshold_percent, absolute, .ns, confidence, info.weight) * causalScale(causal_support); const label = normalizedLabel(row.label, row.key); try items.append(allocator, .{ .kind = .timing_metric, .workload = row.workload, .package = info.package, .component = info.component, .label = label, .key = row.key, .evidence = evidence, .confidence = confidence, .workload_weight = info.weight, .percent_change = row.percent_change, .threshold_percent = row.threshold_percent, .absolute_change = absolute, .unit = .ns, .causal_max_program_speedup = causal_support, .score = score, .reason = try itemReason(allocator, .timing_metric, evidence, row.percent_change, row.threshold_percent, absolute, .ns, confidence, info.weight, causal_support), });}fn appendMemoryItem( allocator: std.mem.Allocator, items: *std.ArrayList(Item), workloads: []const WorkloadSummary, row: memory.Comparison,) !void { const info = workloadInfo(workloads, row.workload); const evidence = memoryEvidence(row.status); const confidence = confidenceForEvidence(evidence); const absolute = @max(row.candidate_value - row.baseline_value, 0); const unit = memoryUnit(row.unit); const component = if (isAllocation(row.key, row.label)) "resource:allocation" else info.component; const score = scoreFor(row.percent_change, row.threshold_percent, absolute, unit, confidence, info.weight); const label = normalizedLabel(row.label, row.key); try items.append(allocator, .{ .kind = .memory_metric, .workload = row.workload, .package = info.package, .component = component, .label = label, .key = row.key, .evidence = evidence, .confidence = confidence, .workload_weight = info.weight, .percent_change = row.percent_change, .threshold_percent = row.threshold_percent, .absolute_change = absolute, .unit = unit, .score = score, .reason = try itemReason(allocator, .memory_metric, evidence, row.percent_change, row.threshold_percent, absolute, unit, confidence, info.weight, null), });}fn buildComponents(allocator: std.mem.Allocator, items: []const Item) ![]const Component { var builders: std.ArrayList(ComponentBuilder) = .empty; for (items, 0..) |item, item_index| { const builder_index = try ensureComponent(allocator, &builders, item.component, item_index); var builder = &builders.items[builder_index]; builder.score += item.score; builder.issue_count += 1; if (item.score > items[builder.strongest_index].score) builder.strongest_index = item_index; if (!hasWorkload(builder.workloads.items, item.workload)) try builder.workloads.append(allocator, item.workload); } var result: std.ArrayList(Component) = .empty; for (builders.items) |builder| { const strongest = items[builder.strongest_index]; try result.append(allocator, .{ .component = builder.component, .score = builder.score, .affected_workloads = builder.workloads.items.len, .issue_count = builder.issue_count, .strongest_workload = strongest.workload, .strongest_label = strongest.label, .strongest_score = strongest.score, .reason = try componentReason(allocator, builder.component, builder.score, builder.workloads.items.len, builder.issue_count, strongest), }); } const component_slice = try result.toOwnedSlice(allocator); sortComponents(component_slice); for (component_slice, 0..) |*component, index| component.rank = index + 1; return component_slice;}fn ensureComponent(allocator: std.mem.Allocator, builders: *std.ArrayList(ComponentBuilder), component: []const u8, item_index: usize) !usize { for (builders.items, 0..) |builder, index| { if (std.mem.eql(u8, builder.component, component)) return index; } try builders.append(allocator, .{ .component = component, .strongest_index = item_index }); return builders.items.len - 1;}fn workloadInfo(workloads: []const WorkloadSummary, workload_name: []const u8) WorkloadInfo { if (catalog.find(workload_name)) |workload| return .{ .package = workload.package, .component = workload.priorityComponent(), .weight = workload.priorityWeight(), }; if (findWorkload(workloads, workload_name)) |workload| return .{ .package = workload.package, .component = if (workload.package.len == 0) workload.name else workload.package, .weight = 1, }; return .{ .package = "", .component = workload_name, .weight = 1 };}fn findWorkload(workloads: []const WorkloadSummary, workload_name: []const u8) ?WorkloadSummary { for (workloads) |workload| { if (std.mem.eql(u8, workload.name, workload_name)) return workload; } return null;}fn timingEvidence(status: []const u8) Evidence { if (std.mem.eql(u8, status, "sample_regression")) return .sample_regression; if (std.mem.eql(u8, status, "interval_regression")) return .interval_regression; if (std.mem.eql(u8, status, "sample_regression_uncertain")) return .uncertain_regression; if (std.mem.eql(u8, status, "sample_regression_candidate")) return .uncertain_regression; if (std.mem.eql(u8, status, "summary_regression_candidate")) return .uncertain_regression; return .point_regression;}fn wallEvidence(status: []const u8) Evidence { return timingEvidence(status);}fn memoryEvidence(status: []const u8) Evidence { if (std.mem.eql(u8, status, "allocation_sample_regression")) { return .sample_regression; } if (std.mem.eql(u8, status, "allocation_sample_regression_uncertain") or std.mem.eql(u8, status, "allocation_sample_regression_candidate") or std.mem.eql(u8, status, "allocation_repetition_incomplete")) { return .uncertain_regression; } if (std.mem.eql(u8, status, "allocation_regression_candidate")) return .allocation_candidate; return .memory_regression;}test "profiling priority preserves allocation repetition confidence" { try std.testing.expectEqual( Evidence.sample_regression, memoryEvidence("allocation_sample_regression"), ); try std.testing.expectEqual( Evidence.uncertain_regression, memoryEvidence("allocation_sample_regression_uncertain"), ); try std.testing.expectEqual( Evidence.uncertain_regression, memoryEvidence("allocation_repetition_incomplete"), ); try std.testing.expectEqual( Evidence.allocation_candidate, memoryEvidence("allocation_regression_candidate"), );}fn confidenceForEvidence(evidence: Evidence) f64 { return switch (evidence) { .sample_regression => 1.0, .interval_regression => 0.9, .memory_regression => 0.75, .observed_regression => 0.65, .allocation_candidate => 0.6, .uncertain_regression => 0.25, .point_regression => 0.2, };}fn memoryUnit(unit: memory.Unit) Unit { return switch (unit) { .bytes => .bytes, .count => .count, };}fn scoreFor(percent: f64, threshold: f64, absolute: f64, unit: Unit, confidence: f64, weight: f64) f64 { const bounded_threshold = if (threshold <= 0) 1 else threshold; const severity = std.math.log2(1 + (@max(percent, 0) / bounded_threshold)); const scale = @max(scaleFor(absolute, unit), 0.25); return severity * scale * confidence * weight;}fn causalScale(causal_support: ?f64) f64 { const support = causal_support orelse return 1; return 1 + std.math.clamp(support, 0, 1);}fn scaleFor(absolute: f64, unit: Unit) f64 { const divisor: f64 = switch (unit) { .ns => 1_000_000, .kib => 1024, .bytes => 64 * 1024, .count => 16, }; return std.math.log2(1 + (@max(absolute, 0) / divisor));}fn positiveDiffU64(base: u64, candidate: u64) f64 { if (candidate <= base) return 0; return @floatFromInt(candidate - base);}fn positiveDiffI64(base: ?i64, candidate: ?i64) ?f64 { const base_value = base orelse return null; const candidate_value = candidate orelse return null; if (candidate_value <= base_value) return 0; return @floatFromInt(candidate_value - base_value);}fn isAllocation(key: []const u8, label: []const u8) bool { return std.mem.indexOf(u8, key, "alloc") != null or std.mem.indexOf(u8, label, "alloc") != null;}fn normalizedLabel(label: []const u8, fallback: []const u8) []const u8 { const trimmed = std.mem.trim(u8, label, " \t\r\n"); if (trimmed.len == 0) return fallback; return trimmed;}fn hasWorkload(workloads: []const []const u8, value: []const u8) bool { for (workloads) |workload| { if (std.mem.eql(u8, workload, value)) return true; } return false;}fn item_priority_descending(_: void, left: Item, right: Item) bool { if (left.score == right.score) return std.mem.lessThan(u8, left.workload, right.workload); return left.score > right.score;}fn component_priority_descending(_: void, left: Component, right: Component) bool { if (left.score == right.score) return std.mem.lessThan(u8, left.component, right.component); return left.score > right.score;}fn sortItems(items: []Item) void { std.mem.sort(Item, items, {}, item_priority_descending);}fn sortComponents(components: []Component) void { std.mem.sort(Component, components, {}, component_priority_descending);}fn itemReason( allocator: std.mem.Allocator, kind: Kind, evidence: Evidence, percent: f64, threshold: f64, absolute: f64, unit: Unit, confidence: f64, weight: f64, causal_support: ?f64,) ![]const u8 { if (causal_support) |support| { return try std.fmt.allocPrint(allocator, "{s} is {d:.2}% over baseline against a " ++ "{d:.2}% threshold with {s} evidence, {d:.2} confidence, {d:.2} workload weight, " ++ "{d:.2} {s} absolute growth, and repeated Coz experiments predict up to {d:.1}% " ++ "program speedup from this workload's hottest region", .{ kind.name(), percent, threshold, evidence.name(), confidence, weight, absolute, unit.name(), support * 100, }); } return try std.fmt.allocPrint(allocator, "{s} is {d:.2}% over baseline against a {d:.2}% threshold with {s} evidence, {d:.2} confidence, {d:.2} workload weight, and {d:.2} {s} absolute growth", .{ kind.name(), percent, threshold, evidence.name(), confidence, weight, absolute, unit.name(), });}fn componentReason( allocator: std.mem.Allocator, component: []const u8, score: f64, workload_count: usize, issue_count: usize, strongest: Item,) ![]const u8 { return try std.fmt.allocPrint(allocator, "{s} aggregates {d} issue(s) across {d} workload(s); strongest signal is {s} on {s} at score {d:.2} of total {d:.2}", .{ component, issue_count, workload_count, strongest.label, strongest.workload, strongest.score, score, });}test "profiling priority gives sample evidence more weight than uncertain evidence" { var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena_state.deinit(); const allocator = arena_state.allocator(); const workloads = [_]WorkloadSummary{ .{ .name = "certain", .package = "lib/certain", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, .{ .name = "uncertain", .package = "lib/uncertain", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, }; const timing = [_]metric.Comparison{ .{ .workload = "uncertain", .key = "metric", .label = "metric", .baseline_ns = 100, .candidate_ns = 120, .percent_change = 20, .threshold_percent = 10, .baseline_samples = 4, .candidate_samples = 4, .baseline_distribution = .raw_samples, .candidate_distribution = .raw_samples, .status = "sample_regression_uncertain", }, .{ .workload = "certain", .key = "metric", .label = "metric", .baseline_ns = 100, .candidate_ns = 120, .percent_change = 20, .threshold_percent = 10, .baseline_samples = 4, .candidate_samples = 4, .baseline_distribution = .raw_samples, .candidate_distribution = .raw_samples, .status = "sample_regression", }, }; const report = try build(allocator, &workloads, &.{}, &timing, &.{}, &.{}); try std.testing.expectEqual(@as(usize, 2), report.items.len); try std.testing.expectEqualStrings("certain", report.items[0].workload); try std.testing.expect(report.items[0].score > report.items[1].score);}test "profiling priority preserves process effect confidence" { var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena_state.deinit(); const allocator = arena_state.allocator(); const workloads = [_]WorkloadSummary{ .{ .name = "supported", .package = "lib/supported", .step = "bench", .wall_ns = 130, .max_rss_kib = null, }, .{ .name = "uncertain", .package = "lib/uncertain", .step = "bench", .wall_ns = 130, .max_rss_kib = null, }, }; const shared = WorkloadComparison{ .workload = "supported", .baseline_wall_ns = 100, .candidate_wall_ns = 130, .wall_percent_change = 30, .baseline_wall_samples = 4, .candidate_wall_samples = 4, .baseline_wall_distribution = "raw_executions", .candidate_wall_distribution = "raw_executions", .wall_effect_low_percent = 28, .wall_effect_high_percent = 32, .wall_status = "sample_regression", .baseline_max_rss_kib = null, .candidate_max_rss_kib = null, .rss_percent_change = null, .wall_threshold_percent = 10, .rss_threshold_percent = 10, .kind = "wall", }; var uncertain = shared; uncertain.workload = "uncertain"; uncertain.wall_effect_low_percent = -5; uncertain.wall_effect_high_percent = 70; uncertain.wall_status = "sample_regression_uncertain"; const report = try build( allocator, &workloads, &.{ uncertain, shared }, &.{}, &.{}, &.{}, ); try std.testing.expectEqual(@as(usize, 2), report.items.len); try std.testing.expectEqualStrings("supported", report.items[0].workload); try std.testing.expectEqual(Evidence.sample_regression, report.items[0].evidence); try std.testing.expectEqual(Evidence.uncertain_regression, report.items[1].evidence);}test "profiling priority aggregates allocation issues by resource component" { var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena_state.deinit(); const allocator = arena_state.allocator(); const workloads = [_]WorkloadSummary{ .{ .name = "left", .package = "lib/left", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, .{ .name = "right", .package = "lib/right", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, }; const rows = [_]memory.Comparison{ .{ .workload = "left", .key = "allocations|allocated_bytes", .label = "allocated bytes", .budget_kind = .allocation, .unit = .bytes, .baseline_value = 100, .candidate_value = 200, .percent_change = 100, .threshold_percent = 10, .status = "allocation_regression_candidate", }, .{ .workload = "right", .key = "bench|alloc_count_per_eval", .label = "alloc count", .budget_kind = .allocation, .unit = .count, .baseline_value = 10, .candidate_value = 20, .percent_change = 100, .threshold_percent = 10, .status = "allocation_regression_candidate", }, }; const report = try build(allocator, &workloads, &.{}, &.{}, &rows, &.{}); try std.testing.expectEqual(@as(usize, 2), report.items.len); try std.testing.expectEqual(@as(usize, 1), report.components.len); try std.testing.expectEqualStrings("resource:allocation", report.components[0].component); try std.testing.expectEqual(@as(usize, 2), report.components[0].affected_workloads); try std.testing.expectEqual(@as(usize, 2), report.components[0].issue_count);}test "profiling priority discounts large uncertain timing candidates" { var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena_state.deinit(); const allocator = arena_state.allocator(); const workloads = [_]WorkloadSummary{ .{ .name = "gpalloc.allocator", .package = "lib/gpalloc", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, .{ .name = "glom.search", .package = "tools/glom", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, }; const timing = [_]metric.Comparison{.{ .workload = "gpalloc.allocator", .key = "duration", .label = "duration", .baseline_ns = 787914, .candidate_ns = 4098611, .percent_change = 420, .threshold_percent = 30, .baseline_samples = 2, .candidate_samples = 2, .baseline_distribution = .confidence_interval, .candidate_distribution = .confidence_interval, .effect_low_percent = -7, .effect_high_percent = 457, .status = "sample_regression_uncertain", }}; const rows = [_]memory.Comparison{.{ .workload = "glom.search", .key = "allocations|allocated_bytes", .label = "allocations|allocated_bytes", .budget_kind = .allocation, .unit = .bytes, .baseline_value = 164541672, .candidate_value = 197307424, .percent_change = 19.9, .threshold_percent = 10, .status = "allocation_regression_candidate", }}; const report = try build(allocator, &workloads, &.{}, &timing, &rows, &.{}); try std.testing.expectEqual(@as(usize, 2), report.items.len); try std.testing.expectEqualStrings("resource:allocation", report.items[0].component); try std.testing.expectEqual(Evidence.allocation_candidate, report.items[0].evidence); try std.testing.expectEqual(Evidence.uncertain_regression, report.items[1].evidence);}test "profiling priority dampens tiny allocation percentage deltas" { var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena_state.deinit(); const allocator = arena_state.allocator(); const workloads = [_]WorkloadSummary{ .{ .name = "mprompt.smoke", .package = "lib/mprompt", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, .{ .name = "gpalloc.allocator", .package = "lib/gpalloc", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, }; const timing = [_]metric.Comparison{.{ .workload = "gpalloc.allocator", .key = "duration", .label = "duration_ns gpalloc steady working-set churn x2048", .baseline_ns = 1_159_002, .candidate_ns = 8_604_410, .percent_change = 642.4, .threshold_percent = 30, .baseline_samples = 8, .candidate_samples = 8, .baseline_distribution = .confidence_interval, .candidate_distribution = .confidence_interval, .status = "interval_regression", }}; const rows = [_]memory.Comparison{.{ .workload = "mprompt.smoke", .key = "allocations|allocated_bytes", .label = "allocations|allocated_bytes", .budget_kind = .allocation, .unit = .bytes, .baseline_value = 768, .candidate_value = 29_566, .percent_change = 3749.74, .threshold_percent = 10, .status = "allocation_regression_candidate", }}; const report = try build(allocator, &workloads, &.{}, &timing, &rows, &.{}); try std.testing.expectEqual(@as(usize, 2), report.items.len); try std.testing.expectEqualStrings("gpalloc.allocator", report.items[0].workload); try std.testing.expectEqualStrings("mprompt.smoke", report.items[1].workload);}const causal_support_test_results = [_]coz.Result{ .{ .workload = "supported", .kind = "throughput", .file = "src/eval.zig", .line = 42, .progress_point = "bench.sample", .min_program_speedup = 0, .max_program_speedup = 0.4, .slope = 0.8, .total_selected_samples = 128, .support = .{ .status = .within_run_repeated_curve, .speedup_point_count = 2, .experiment_count = 4, .baseline_experiment_count = 2, .minimum_experiments_per_point = 2, }, }, .{ .workload = "plain", .kind = "throughput", .file = "src/plain.zig", .line = 9, .progress_point = "bench.sample", .min_program_speedup = 0, .max_program_speedup = 0.9, .slope = 1.8, .total_selected_samples = 512, .support = .{ .status = .unreplicated_curve, .speedup_point_count = 2, .experiment_count = 2, .baseline_experiment_count = 1, .minimum_experiments_per_point = 1, }, },};test "profiling priority raises causally supported timing items" { var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena_state.deinit(); const allocator = arena_state.allocator(); const workloads = [_]WorkloadSummary{ .{ .name = "supported", .package = "lib/supported", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, .{ .name = "plain", .package = "lib/plain", .step = "bench", .wall_ns = 0, .max_rss_kib = null }, }; const shared = metric.Comparison{ .workload = "plain", .key = "metric", .label = "metric", .baseline_ns = 100, .candidate_ns = 120, .percent_change = 20, .threshold_percent = 10, .baseline_samples = 4, .candidate_samples = 4, .baseline_distribution = .raw_samples, .candidate_distribution = .raw_samples, .status = "sample_regression", }; var supported = shared; supported.workload = "supported"; const timing = [_]metric.Comparison{ shared, supported }; const report = try build( allocator, &workloads, &.{}, &timing, &.{}, &causal_support_test_results, ); try std.testing.expectEqual(@as(usize, 2), report.items.len); try std.testing.expectEqualStrings("supported", report.items[0].workload); try std.testing.expectEqual(@as(f64, 0.4), report.items[0].causal_max_program_speedup.?); try std.testing.expect(report.items[0].score > report.items[1].score); try std.testing.expect(report.items[1].causal_max_program_speedup == null); try std.testing.expect(std.mem.indexOf( u8, report.items[0].reason, "repeated Coz experiments predict up to 40.0%", ) != null);}Source: src/profiling/root.zig:37
zig
pub const priority = @import("priority.zig");Complete caller list for priority.build
7 direct callers.
tiny.profiling.analyze.evidence.comparisonEvidence[function] atsrc/profiling/analyze/evidence.zig:37src.profiling.priority.test_profiling_priority_aggregates_allocation_issues_by_resource_component[function] — test; no exact target atsrc/profiling/priority.zig:635in nearest public ownertiny.profiling.prioritysrc.profiling.priority.test_profiling_priority_dampens_tiny_allocation_percentage_deltas[function] — test; no exact target atsrc/profiling/priority.zig:720in nearest public ownertiny.profiling.prioritysrc.profiling.priority.test_profiling_priority_discounts_large_uncertain_timing_candidates[function] — test; no exact target atsrc/profiling/priority.zig:677in nearest public ownertiny.profiling.prioritysrc.profiling.priority.test_profiling_priority_gives_sample_evidence_more_weight_than_uncertain_evidence[function] — test; no exact target atsrc/profiling/priority.zig:533in nearest public ownertiny.profiling.prioritysrc.profiling.priority.test_profiling_priority_preserves_process_effect_confidence[function] — test; no exact target atsrc/profiling/priority.zig:577in nearest public ownertiny.profiling.prioritysrc.profiling.priority.test_profiling_priority_raises_causally_supported_timing_items[function] — test; no exact target atsrc/profiling/priority.zig:799in nearest public ownertiny.profiling.priority
Audit
| Definitions | 12 |
|---|---|
| Public names | 12 |
| Members | 48 |
| Version | 26.7.0 |
| Revision | daab053ee433 |