summaryrefslogtreecommitdiff
path: root/test/perf.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/perf.zig')
-rw-r--r--test/perf.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/perf.zig b/test/perf.zig
index 8f463204..5ac38ccf 100644
--- a/test/perf.zig
+++ b/test/perf.zig
@@ -200,6 +200,10 @@ fn measureStartup(io: std.Io, reps: usize, json: bool) !void {
bytes += counter.bytes;
peak = @max(peak, counter.peak);
}
+ // Every other measurement in this file checks the session gave
+ // everything back; a boot that leaks is exactly what a startup
+ // benchmark should be the first to notice.
+ if (counter.live != 0) return error.LeakedStartupMemory;
}
std.mem.sort(u64, init_samples, {}, std.sort.asc(u64));
std.mem.sort(u64, frame_samples, {}, std.sort.asc(u64));
@@ -212,7 +216,10 @@ fn measureStartup(io: std.Io, reps: usize, json: bool) !void {
.reps = reps,
.cold_ns = cold_ns,
.init_median_ns = init_samples[reps / 2],
- .init_p95_ns = init_samples[@min(reps - 1, reps * 95 / 100)],
+ // A p95 needs at least twenty samples to be one; below that this
+ // is the maximum and says so rather than dressing it up.
+ .init_p95_ns = if (reps >= 20) init_samples[reps * 95 / 100] else init_samples[reps - 1],
+ .init_max_ns = init_samples[reps - 1],
.frame_median_ns = frame_samples[reps / 2],
.allocations = calls / reps,
.allocated_bytes = bytes / reps,