24#ifndef CS_MTA_TIME_BASED_METRIC
25#define CS_MTA_TIME_BASED_METRIC
53 void reset()
override;
Abstract class for time based metrics implementations.
Definition: time_based_metric_interface.h:30
Class that encodes how much time we waited for something.
Definition: time_based_metric.h:31
void start_timer() override
Starts counting time we are waiting on something.
Definition: time_based_metric.cc:43
int64_t get_sum_time_elapsed() const override
Returns the time waited across all executions of the start/stop methods.
Definition: time_based_metric.cc:56
std::atomic< int64_t > m_count
The number of times we waited.
Definition: time_based_metric.h:88
Time_based_metric(Time_based_metric &&)=delete
Time_based_metric & operator=(const Time_based_metric &other)
Assignment operator.
Definition: time_based_metric.cc:31
static int64_t now()
Helper to get current time.
Definition: time_based_metric.cc:70
Time_based_metric(const Time_based_metric &)=delete
Deleted copy constructor, move constructor, move assignment operator.
~Time_based_metric() override=default
Default destuctor.
Time_based_metric & operator=(Time_based_metric &&)=delete
bool m_manual_counting
If false, the counter is incremented automatically by start_time, and the caller must not invoke incr...
Definition: time_based_metric.h:93
int64_t get_count() const override
Returns the number of time we waited on give spot.
Definition: time_based_metric.cc:68
Time_based_metric(bool manual_counting=false)
Constructor that allows you to define counting as being manual.
Definition: time_based_metric.cc:28
void reset() override
Resets the counter and summed time to 0.
Definition: time_based_metric.cc:38
void stop_timer() override
Stops the timer for the wait.
Definition: time_based_metric.cc:51
void increment_counter() override
Increments the waiting counter.
Definition: time_based_metric.cc:63
std::atomic< int64_t > m_time
The total nanoseconds of all completed waits, minus the absolute start time of an ongoing wait,...
Definition: time_based_metric.h:86