Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::MonotonicStopWatch Class Reference

#include <stopwatch.h>

Collaboration diagram for impala::MonotonicStopWatch:

Public Member Functions

 MonotonicStopWatch ()
 
void Start ()
 
void Stop ()
 
uint64_t Reset ()
 Restarts the timer. Returns the elapsed time until this point. More...
 
uint64_t ElapsedTime () const
 Returns time in nanosecond. More...
 

Private Attributes

timespec start_
 
uint64_t total_time_
 
bool running_
 

Detailed Description

Stop watch for reporting elapsed time in nanosec based on CLOCK_MONOTONIC. It is as fast as Rdtsc. It is also accurate because it not affected by cpu frequency changes and it is not affected by user setting the system clock. CLOCK_MONOTONIC represents monotonic time since some unspecified starting point. It is good for computing elapsed time.

Definition at line 74 of file stopwatch.h.

Constructor & Destructor Documentation

impala::MonotonicStopWatch::MonotonicStopWatch ( )
inline

Definition at line 76 of file stopwatch.h.

References running_, and total_time_.

Member Function Documentation

uint64_t impala::MonotonicStopWatch::Reset ( )
inline

Restarts the timer. Returns the elapsed time until this point.

Definition at line 96 of file stopwatch.h.

References ElapsedTime(), running_, and start_.

Referenced by impala::StatestoreSubscriber::Heartbeat(), and impala::StatestoreSubscriber::UpdateState().

Member Data Documentation

bool impala::MonotonicStopWatch::running_
private

Definition at line 116 of file stopwatch.h.

Referenced by ElapsedTime(), MonotonicStopWatch(), Reset(), Start(), and Stop().

timespec impala::MonotonicStopWatch::start_
private

Definition at line 114 of file stopwatch.h.

Referenced by ElapsedTime(), Reset(), and Start().

uint64_t impala::MonotonicStopWatch::total_time_
private

Definition at line 115 of file stopwatch.h.

Referenced by ElapsedTime(), MonotonicStopWatch(), and Stop().


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