package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/octez-libs.stdlib-unix/Tezos_stdlib_unix/Moving_average/index.html
Module Tezos_stdlib_unix.Moving_average
Source
Moving averages.
This module implements bandwidth counters based on (cumulative) exponential moving average. Each counter is identified by an integer. They are stored in an internal hash table.
See i.e. https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average for the algorithm.
Type of one bandwidth counter.
Internal state of the worker handling a family of counters.
fresh_state ~id ~refresh_interval
initializes the state of a worker handling a family of counter. The worker wakes up every refresh_interval
seconds. id
is a string identifier used for distinguishing distinct Moving_average workers..
create state ~init ~alpha
is a counter with initial value init
and factor alpha
. The counter is added to the state
. It is not removed automatically: it must be removed manually.
on_update state f
registers f
to be called on each update of the internal worker associated to state
.
updated state
is a condition variable that gets signaled on each update of the internal worker..