CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
perf::Recorder Class Reference

#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_
 

Detailed Description

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 180 of file statistics.h.

Constructor & Destructor Documentation

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 175 of file statistics.cc.

Here is the call graph for this function:

Member Function Documentation

uint32_t perf::Recorder::capacity_s ( ) const
inline

Definition at line 188 of file statistics.h.

uint64_t perf::Recorder::GetNoTicks ( uint32_t  retrospect_s) const

Definition at line 224 of file statistics.cc.

Here is the call graph for this function:

uint32_t perf::Recorder::resolution_s ( ) const
inline

Definition at line 189 of file statistics.h.

void perf::Recorder::Tick ( )

Definition at line 192 of file statistics.cc.

Here is the call graph for this function:

void perf::Recorder::TickAt ( uint64_t  timestamp)

Definition at line 197 of file statistics.cc.

Referenced by Tick().

Here is the caller graph for this function:

Member Data Documentation

std::vector<uint32_t> perf::Recorder::bins_
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 196 of file statistics.h.

Referenced by GetNoTicks(), Recorder(), and TickAt().

uint32_t perf::Recorder::capacity_s_
private

Time window in seconds that the recorder is supposed to remember.

Definition at line 206 of file statistics.h.

Referenced by Recorder().

uint64_t perf::Recorder::last_timestamp_
private

When the most recent tick occured.

Definition at line 201 of file statistics.h.

Referenced by GetNoTicks(), and TickAt().

unsigned perf::Recorder::no_bins_
private

Shorthand for bins_.size(), constant during lifetime of the recorder.

Definition at line 216 of file statistics.h.

Referenced by GetNoTicks(), Recorder(), and TickAt().

uint32_t perf::Recorder::resolution_s_
private

Size of the bins for the tick counters.

Definition at line 211 of file statistics.h.

Referenced by GetNoTicks(), Recorder(), and TickAt().


The documentation for this class was generated from the following files: