|
KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
|
|
#include <ratemonitor.h>
Public Slots | |
| void | addEvent (int count=1) |
| Record one or more occurrences of the monitored event. | |
Public Member Functions | |
| RateMonitor () | |
| Construct a RateMonitor with a default 1-second evaluation window. | |
| RateMonitor (int evaluationMsecs) | |
| Construct a RateMonitor with a custom evaluation window. | |
| double | eventsPerSecond () |
| Compute the current event rate over the evaluation window. | |
| QVariant | data () const |
| Return the arbitrary data payload attached to this monitor. | |
| void | setData (QVariant value) |
| Attach arbitrary data to this monitor for caller use. | |
| int | evaluationMsecs () const |
| Return the evaluation window duration in milliseconds. | |
| void | setEvaluationTime (int msecs) |
| Set the evaluation window duration. | |
Calculate the rate at which something is happening (e.g. packets-per-second)
Every time the thing happens, call addEvent().
Use eventsPerSecond() to obtain the actual rate.
setEvaluationTime() sets the sliding time window over which the calculation is performed.
Stephen Punak, July 08 2019
Tracks event counts over a sliding time window to compute a real-time rate.
Call addEvent() each time the measured event occurs. Use eventsPerSecond() to retrieve the computed rate over the configured evaluation window.
Definition at line 29 of file ratemonitor.h.
|
inline |
Construct a RateMonitor with a default 1-second evaluation window.
Definition at line 33 of file ratemonitor.h.
|
inline |
Construct a RateMonitor with a custom evaluation window.
| evaluationMsecs | Sliding window duration in milliseconds |
Definition at line 40 of file ratemonitor.h.
|
slot |
Record one or more occurrences of the monitored event.
| count | Number of events to record (default 1) |
|
inline |
Return the arbitrary data payload attached to this monitor.
Definition at line 61 of file ratemonitor.h.
|
inline |
Return the evaluation window duration in milliseconds.
Definition at line 73 of file ratemonitor.h.
| double RateMonitor::eventsPerSecond | ( | ) |
Compute the current event rate over the evaluation window.
|
inline |
Attach arbitrary data to this monitor for caller use.
| value | Data to store |
Definition at line 67 of file ratemonitor.h.
|
inline |
Set the evaluation window duration.
| msecs | New window duration in milliseconds |
Definition at line 79 of file ratemonitor.h.