1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! Internal stats. **Not part of the public API.** The bench harness
//! needs `percentile`, `mean`, `stddev`, `cdf_buckets`, `jitter_score`
//! to compute the standard `SubMsStageSummary` and emit the JSON
//! contract; we duplicate the minimum here rather than depending on
//! the sibling `subms-stats` crate so that recipes downstream don't
//! pick up stats as a transitive dep.
//!
//! Consumers who want a rich statistics surface (CDF buckets, jitter,
//! tail analysis, KS, Cohen's d, bootstrap CIs, ...) should add
//! `subms-stats = "0.5"` directly. Recipes should depend only on
//! `subms`.
//!
//! Mirrors the implementations in `subms_stats::percentiles`,
//! `subms_stats::histogram`, `subms_stats::jitter`. Keep them
//! byte-equivalent: any divergence will surface as a JSON contract
//! mismatch between recipes (which see the subms internal version)
//! and external tooling (which uses subms-stats directly).
/// Percentile over a *sorted* ns array. Empty -> 0.
pub
/// Arithmetic mean. `0` if empty.
pub
/// Sample standard deviation (n-1 denominator). `0` when count < 2.
pub
/// Log2-spaced histogram of latencies. 64 buckets covering
/// `[2^i, 2^(i+1))` nanoseconds for `i in 0..64`.
pub
/// Jitter score: per-window CV across non-overlapping 32-sample
/// windows. Clamped to `[0.0, 1.0]`.
pub