Module Exposed_for_testing.Flow_meter
The type of flow meters for some metric: values that compute an online windowed integral of a discrete sequence of (value, time) samples. This is useful for e.g. estimating the download rate of a process given a sequence of progress updates.
val create :
clock:(unit -> Mtime.t) ->
size:int ->
elt:(module Progress_engine.Integer.S with type t = 'a) ->
'a Progress_engine.Exposed_for_testing.Flow_meter.tcreate ~clock ~size ~elt is a flow meter for values of type elt, using a window size of size and the clock function for collecting timestamps for recorded values.
val record : 'a Progress_engine.Exposed_for_testing.Flow_meter.t -> 'a -> unitAdd a value to the ring buffer.
val per_second : 'a Progress_engine.Exposed_for_testing.Flow_meter.t -> floatEstimate the rate of change of recorded values per second.