24#ifndef CHANGESTREAMS_APPLY_METRICS_TIME_BASED_METRIC_H
25#define CHANGESTREAMS_APPLY_METRICS_TIME_BASED_METRIC_H
58 void reset()
override;
Abstract class for time based metrics implementations.
Definition: time_based_metric_interface.h:32
Class that encodes how much time we waited for something.
Definition: time_based_metric.h:31
void start_timer() override
Starts the timer.
Definition: time_based_metric.cc:49
std::atomic< int64_t > m_count
The number of times we waited.
Definition: time_based_metric.h:96
Time_based_metric(Time_based_metric &&)=delete
Time_based_metric & operator=(const Time_based_metric &other)
Copy assignment operator.
Definition: time_based_metric.cc:31
static int64_t now()
Helper to get current time.
Definition: time_based_metric.cc:76
int64_t get_time() const override
Returns the time waited across all executions of the start/stop methods.
Definition: time_based_metric.cc:62
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:101
int64_t get_count() const override
Returns the number of time we waited on give spot.
Definition: time_based_metric.cc:74
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:44
void stop_timer() override
Stops the timer.
Definition: time_based_metric.cc:57
void increment_counter() override
Increment the counter.
Definition: time_based_metric.cc:69
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:94