package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=55ea1fb8bb3273a7fc270ca8f650d45c56449665619482aad9bc12f3ea736b7e
sha512=fec850fc2d17d7490bbabd5147d62aad13b3aaed8774270f8a38ab419670ed03e0fd30cf8642a97984eca5c2446726fe590ad99c015f7ec50919dc7652f25053
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..