]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/FadingCounter.h
5 #ifndef SQUID_FADING_COUNTER_H
6 #define SQUID_FADING_COUNTER_H
10 /// Counts events, forgetting old ones. Usefull for "3 errors/minute" limits.
16 /// 0=remember nothing; -1=forget nothing; new value triggers clear()
17 void configure(double horizonSeconds
);
19 void clear(); ///< forgets all events
21 int count(int howMany
); ///< count fresh, return #events remembered
22 int remembered() const { return total
; } ///< possibly stale #events
24 /// read-only memory horizon in seconds; older events are forgotten
28 const int precision
; ///< #counting slots, controls measur. occuracy
29 double delta
; ///< sub-interval duration = horizon/precision
31 double lastTime
; ///< time of the last update
32 Vector
<int> counters
; ///< events per delta (possibly stale)
33 int total
; ///< number of remembered events (possibly stale)
36 #endif /* SQUID_FADING_COUNTER_H */