NanoTimer Class Reference

#include <NanoTimer.h>


Public Member Functions

 NanoTimer ()
void reset ()
void start ()
void stop ()
long long last ()
long long avg ()
long long min ()
long long max ()


Detailed Description

Definition at line 20 of file NanoTimer.h.


Constructor & Destructor Documentation

NanoTimer::NanoTimer (  )  [inline]

Definition at line 27 of file NanoTimer.h.

References reset().

00027 {  reset(); }

Here is the call graph for this function:


Member Function Documentation

long long NanoTimer::avg (  )  [inline]

Definition at line 45 of file NanoTimer.h.

00045 { return total/count; }

long long NanoTimer::last (  )  [inline]

Definition at line 44 of file NanoTimer.h.

00044 { return last_; }

long long NanoTimer::max (  )  [inline]

Definition at line 47 of file NanoTimer.h.

00047 { return max_; }

long long NanoTimer::min (  )  [inline]

Definition at line 46 of file NanoTimer.h.

00046 { return min_; }

void NanoTimer::reset (  )  [inline]

Definition at line 28 of file NanoTimer.h.

Referenced by NanoTimer().

00028 {  max_ = 0; min_ = LONG_MAX; total =0; count = 0; last_ =0; }

Here is the caller graph for this function:

void NanoTimer::start (  )  [inline]

Definition at line 29 of file NanoTimer.h.

00030     {
00031         count++;
00032         clock_gettime(CLOCK_REALTIME, &begin);
00033     }

void NanoTimer::stop (  )  [inline]

Definition at line 34 of file NanoTimer.h.

00035     {
00036         clock_gettime(CLOCK_REALTIME, &end);
00037         long long secs = end.tv_sec-begin.tv_sec;
00038         long long nano = end.tv_nsec-begin.tv_nsec;
00039         last_ = (secs*1000000000)+nano;
00040         total += last_;
00041         if ( max_ < last_ ) max_ = last_;
00042         if ( min_ > last_ ) min_ = last_;
00043     }


The documentation for this class was generated from the following file:
Generated on Mon Jun 9 22:48:46 2008 for csql by  doxygen 1.4.7