]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: freq_ctr: add swrate_add_scaled() to work with large samples
authorWilly Tarreau <w@1wt.eu>
Wed, 17 Oct 2018 07:24:56 +0000 (09:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Oct 2018 06:13:57 +0000 (08:13 +0200)
commit627505d36a1ef9a34eeeb22965cfff44540a1c05
treef19a08805d5ba18b8aa3ea12ef681a284e1a66ff
parent23cd43e2d6fa2b6892a786a1a720c5f24e657f10
MINOR: freq_ctr: add swrate_add_scaled() to work with large samples

Some samples representing time will cover more than one sample at once
if they are units of time per time. For this we'd need to have the
ability to loop over swrate_add() multiple times but that would be
inefficient. By developing the function elevated to power N, it's
visible that some coefficients quickly disappear and that those which
remain at the first order more or less compensate each other.

Thus a simplified version of this function was added to provide a single
value for a given number of samples. Tests with multiple values, window
sizes and sample sizes have shown that it is possible to make it remain
surprisingly accurate (typical error < 0.2% over various large window
and sample sizes, even samples representing up to 1/4 of the window).
include/proto/freq_ctr.h