Malachi. Loadtest. Histogram
(malachi v0.8.13)
View Source
A lock-free latency histogram for the load generator: an :atomics array of log-spaced buckets that
every connection process writes to concurrently, with no per-op allocation and no shared GenServer.
Latencies are recorded in microseconds. Bucket b covers [2^((b-1)/scale), 2^(b/scale)) us, so the
resolution is 2^(1/scale) - 1 (about 4.4% at scale = 16), fine enough for tail percentiles while
keeping the array tiny. Percentiles return the representative us of the bucket the rank falls in.
Summary
Functions
Total number of samples recorded.
The p-th percentile in microseconds (p in 0..100), or 0.0 if empty. Walks the cumulative counts
and returns the representative us of the bucket where the rank lands.
Records one latency sample (microseconds).
Types
Functions
@spec count(t()) :: non_neg_integer()
Total number of samples recorded.
@spec new() :: t()
The p-th percentile in microseconds (p in 0..100), or 0.0 if empty. Walks the cumulative counts
and returns the representative us of the bucket where the rank lands.
Records one latency sample (microseconds).