lib/bench/src/stats/model.zig
daab053ee43316e1809a84551d573ddd1e5bf3d2
1 pub const default_bootstrap_iterations: u32 = 1000;
2 pub const default_bootstrap_seed: u64 = 0x5449_4e59_4245_4e43;
3
4 pub const BootstrapConfig = struct {
5 iterations: u32 = default_bootstrap_iterations,
6 seed: u64 = default_bootstrap_seed,
7 confidence_per_mille: u16 = 950,
8 };
9
10 pub const ConfidenceInterval = struct {
11 low_ns: f64,
12 high_ns: f64,
13 };
14
15 pub const BootstrapConfidenceIntervals = struct {
16 confidence: f64,
17 iterations: u32,
18 seed: u64,
19 mean_ns: ConfidenceInterval,
20 median_ns: ConfidenceInterval,
21 p75_ns: ConfidenceInterval,
22 p95_ns: ConfidenceInterval,
23 p99_ns: ConfidenceInterval,
24 };
25
26 pub const SampleStats = struct {
27 min_ns: u64,
28 max_ns: u64,
29 mean_ns: f64,
30 median_ns: u64,
31 p75_ns: u64,
32 p95_ns: u64,
33 p99_ns: u64,
34 total_ns: u64,
35 confidence_intervals: ?BootstrapConfidenceIntervals = null,
36 };
37
38 pub const Exhaustion = error{
39 SampleCapacityExceeded,
40 BootstrapIterationCapacityExceeded,
41 StatisticsStorageInUse,
42 };
43
44 pub const InputError = error{
45 EmptySampleSet,
46 InvalidBootstrapConfidence,
47 };
48
49 pub const ComputeError = Exhaustion || InputError;