Counts events, forgetting old ones. Useful for "3 errors/minute" limits. More...
#include <FadingCounter.h>

Public Member Functions | |
FadingCounter () | |
void | configure (double horizonSeconds) |
0=remember nothing; -1=forget nothing; new value triggers clear() More... | |
void | clear () |
forgets all events More... | |
int | count (int howMany) |
count fresh, return #events remembered More... | |
Public Attributes | |
double | horizon |
read-only memory horizon in seconds; older events are forgotten More... | |
Private Attributes | |
const int | precision |
#counting slots, controls measur. accuracy More... | |
double | delta |
sub-interval duration = horizon/precision More... | |
double | lastTime |
time of the last update More... | |
std::vector< int > | counters |
events per delta (possibly stale) More... | |
int | total |
number of remembered events (possibly stale) More... | |
Detailed Description
Definition at line 15 of file FadingCounter.h.
Constructor & Destructor Documentation
◆ FadingCounter()
FadingCounter::FadingCounter | ( | ) |
Definition at line 17 of file FadingCounter.cc.
Member Function Documentation
◆ clear()
void FadingCounter::clear | ( | ) |
Definition at line 25 of file FadingCounter.cc.
References counters, current_dtime, lastTime, precision, and total.
Referenced by configure(), and count().
◆ configure()
void FadingCounter::configure | ( | double | horizonSeconds | ) |
Definition at line 33 of file FadingCounter.cc.
References clear(), delta, horizon, and precision.
Referenced by Ssl::ClientBio::ClientBio().
◆ count()
Member Data Documentation
◆ counters
|
private |
Definition at line 36 of file FadingCounter.h.
Referenced by clear(), count(), and FadingCounter().
◆ delta
|
private |
Definition at line 33 of file FadingCounter.h.
Referenced by configure(), and count().
◆ horizon
double FadingCounter::horizon |
Definition at line 29 of file FadingCounter.h.
Referenced by configure(), and count().
◆ lastTime
|
private |
Definition at line 35 of file FadingCounter.h.
◆ precision
|
private |
Definition at line 32 of file FadingCounter.h.
Referenced by clear(), configure(), count(), and FadingCounter().
◆ total
|
private |
Definition at line 37 of file FadingCounter.h.
The documentation for this class was generated from the following files:
- src/FadingCounter.h
- src/FadingCounter.cc
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products