CernVM-FS
2.12.0
|
#include <statistics.h>
Public Member Functions | |
Recorder (uint32_t resolution_s, uint32_t capacity_s) | |
void | Tick () |
void | TickAt (uint64_t timestamp) |
uint64_t | GetNoTicks (uint32_t retrospect_s) const |
uint32_t | capacity_s () const |
uint32_t | resolution_s () const |
Private Attributes | |
std::vector< uint32_t > | bins_ |
uint64_t | last_timestamp_ |
uint32_t | capacity_s_ |
uint32_t | resolution_s_ |
unsigned | no_bins_ |
Keeps track of events over time. Can be used to query the number of events between now and a point in time in the past. The time range should be smaller than capacity_s seconds. Uses a monotonic clock. Not thread-safe.
Definition at line 182 of file statistics.h.
perf::Recorder::Recorder | ( | uint32_t | resolution_s, |
uint32_t | capacity_s | ||
) |
If necessary, capacity_s is extended to be a multiple of resolution_s
Definition at line 196 of file statistics.cc.
|
inline |
Definition at line 190 of file statistics.h.
uint64_t perf::Recorder::GetNoTicks | ( | uint32_t | retrospect_s | ) | const |
|
inline |
Definition at line 191 of file statistics.h.
void perf::Recorder::Tick | ( | ) |
void perf::Recorder::TickAt | ( | uint64_t | timestamp | ) |
Definition at line 218 of file statistics.cc.
Referenced by Tick().
|
private |
Records number of ticks (events) per unit of resolution. A ring buffer. Entries older than capacity_s get overwritten by new events.
Definition at line 198 of file statistics.h.
Referenced by GetNoTicks(), Recorder(), and TickAt().
|
private |
Time window in seconds that the recorder is supposed to remember.
Definition at line 208 of file statistics.h.
Referenced by Recorder().
|
private |
When the most recent tick occurred.
Definition at line 203 of file statistics.h.
Referenced by GetNoTicks(), and TickAt().
|
private |
Shorthand for bins_.size(), constant during lifetime of the recorder.
Definition at line 218 of file statistics.h.
Referenced by GetNoTicks(), Recorder(), and TickAt().
|
private |
Size of the bins for the tick counters.
Definition at line 213 of file statistics.h.
Referenced by GetNoTicks(), Recorder(), and TickAt().