struct CQL::Performance::LatencyHistogram

Overview

Fixed-size log-linear histogram of durations: whole microseconds below SUB_BUCKETS get a bucket each, every power of two above splits into SUB_BUCKETS, sub-microsecond samples land in bucket 0 and samples of RANGE or more in OVERFLOW_INDEX.

Defined in:

performance/utilities.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def initialize #

[View source]
def percentile(q : Float64, count : Int64, min : Time::Span, max : Time::Span) : Time::Span #

Upper bound of the bucket holding rank ceil(q * count), clamped to min..max.


[View source]
def record(duration : Time::Span) : Nil #

Counts duration in its bucket in O(1), without allocating.


[View source]
def reset : Nil #

Clears every bucket.


[View source]