14#ifndef OR_TOOLS_BASE_TIMER_H_
15#define OR_TOOLS_BASE_TIMER_H_
19#include "absl/log/check.h"
20#include "absl/time/clock.h"
21#include "absl/time/time.h"
34 start_ = absl::GetCurrentTimeNanos();
42 sum_ += absl::GetCurrentTimeNanos() - start_;
50 return absl::Nanoseconds(
GetNanos());
56 return running_ ? absl::GetCurrentTimeNanos() - start_ + sum_ : sum_;
87 return static_cast<int64_t
>(s * 1e9);
90 static int64_t
CyclesToMs(int64_t c) {
return c / 1000000; }
108 double* aggregate_time_;
Conversion routines between CycleTimer::GetCycles and actual times.
static int64_t SecondsToCycles(double s)
static int64_t CyclesToUsec(int64_t c)
static double CyclesToSeconds(int64_t c)
static int64_t CyclesToMs(int64_t c)
int64_t GetCycles() const
ScopedWallTime(double *aggregate_time)
int64_t GetInUsec() const
absl::Duration GetDuration() const
void Start()
When Start() is called multiple times, only the most recent is used.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
CycleTimerBase CycleTimerInstance
CycleTimer SimpleCycleTimer