]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: freq_ctr: Add a function to get events excess over the current period
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 22 Jun 2022 13:28:16 +0000 (15:28 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 22 Jun 2022 16:33:27 +0000 (18:33 +0200)
commitaa55640b8c3704de79b576337605d36d93fadfc3
tree840b52adfd9766da6798af9538a67a556e260e29
parentdbbdb25f1c0a96094c4e357105264053644d9255
MINOR: freq_ctr: Add a function to get events excess over the current period

freq_ctr_overshoot_period() function may be used to retrieve the excess of
events over the current period for a givent frequency counter, ignoring the
history. It is a way compare the "current rate" (the number of events over
the current period) to a given rate and estimate the excess of events.

It may be used to safely add new events, especially at the begining of the
current period for a frequency counter with large period. This way, it is
possible to smoothly add events during the whole period without quickly
consuming all the quota at the beginning of the period and waiting for the
next one to be able to add new events.
include/haproxy/freq_ctr.h
src/freq_ctr.c