Source release 15.0.0
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
#ifndef WVCDM_METRICS_TIMER_METRIC_H_
|
||||
#define WVCDM_METRICS_TIMER_METRIC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <chrono>
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
class TimerMetric {
|
||||
|
||||
public:
|
||||
// Constructs a new TimerMetric.
|
||||
explicit TimerMetric() : is_started_(false) {}
|
||||
// Starts the clock running. If the clock was previously set, this resets it.
|
||||
// IsStarted will return true after this call.
|
||||
void Start();
|
||||
// Returns whether or not the timer has started.
|
||||
bool IsStarted() const { return is_started_; };
|
||||
bool IsStarted() const { return is_started_; }
|
||||
// Stops the clock and clears the current value. IsStarted will return false
|
||||
// after this call.
|
||||
void Clear();
|
||||
@@ -23,10 +24,9 @@ class TimerMetric {
|
||||
double AsUs() const;
|
||||
|
||||
private:
|
||||
double sec_;
|
||||
double usec_;
|
||||
std::chrono::steady_clock clock_;
|
||||
std::chrono::time_point<std::chrono::steady_clock> start_;
|
||||
bool is_started_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace metrics
|
||||
|
||||
Reference in New Issue
Block a user