code_profiler
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
tue::Timer Class Reference

#include <timer.h>

Public Member Functions

long double getElapsedTime () const
 Alias of Timer::getElapsedTimeInSec. More...
 
long double getElapsedTimeInMicroSec () const
 Get elasped time in micro-seconds. More...
 
long double getElapsedTimeInMilliSec () const
 Get elasped time in milli-seconds. More...
 
long double getElapsedTimeInSec () const
 Get elasped time in seconds. More...
 
void printLastElapsedTime (std::string)
 
void printLastElapsedTimeMSec (std::string)
 
bool running () const
 Get running status of the timer. More...
 
void start ()
 
void stop ()
 
 Timer ()
 
 ~Timer ()
 

Static Public Member Functions

static long double now ()
 Get the current time in seconds since epoch. More...
 
static long double nowMicroSec ()
 Get the current time in micro-seconds since epoch. More...
 
static long double nowMilliSec ()
 Get the current time in milli-seconds since epoch. More...
 

Private Attributes

timeval end_count_
 End counter. More...
 
bool running_
 Running flag. More...
 
timeval start_count_
 Start counter. More...
 

Detailed Description

Definition at line 30 of file timer.h.

Constructor & Destructor Documentation

◆ Timer()

Timer::Timer ( )

Definition at line 35 of file timer.cpp.

◆ ~Timer()

Timer::~Timer ( )

Definition at line 47 of file timer.cpp.

Member Function Documentation

◆ getElapsedTime()

long double Timer::getElapsedTime ( ) const

Alias of Timer::getElapsedTimeInSec.

Returns
elapsed time in seconds

Definition at line 107 of file timer.cpp.

◆ getElapsedTimeInMicroSec()

long double Timer::getElapsedTimeInMicroSec ( ) const

Get elasped time in micro-seconds.

Returns
elapsed time in micro-seconds

Definition at line 72 of file timer.cpp.

◆ getElapsedTimeInMilliSec()

long double Timer::getElapsedTimeInMilliSec ( ) const

Get elasped time in milli-seconds.

Returns
elapsed time in milli-seconds

Definition at line 97 of file timer.cpp.

◆ getElapsedTimeInSec()

long double Timer::getElapsedTimeInSec ( ) const

Get elasped time in seconds.

Returns
elapsed time in seconds

Definition at line 102 of file timer.cpp.

◆ now()

long double Timer::now ( )
static

Get the current time in seconds since epoch.

Returns
Epoch time in seconds

Definition at line 141 of file timer.cpp.

◆ nowMicroSec()

long double Timer::nowMicroSec ( )
static

Get the current time in micro-seconds since epoch.

Returns
Epoch time in micro-seconds

Definition at line 123 of file timer.cpp.

◆ nowMilliSec()

long double Timer::nowMilliSec ( )
static

Get the current time in milli-seconds since epoch.

Returns
Epoch time in milli-seconds

Definition at line 136 of file timer.cpp.

◆ printLastElapsedTime()

void Timer::printLastElapsedTime ( std::string  m)

Definition at line 112 of file timer.cpp.

◆ printLastElapsedTimeMSec()

void Timer::printLastElapsedTimeMSec ( std::string  m)

Definition at line 118 of file timer.cpp.

◆ running()

bool tue::Timer::running ( ) const
inline

Get running status of the timer.

Returns
running or not running

Definition at line 43 of file timer.h.

◆ start()

void Timer::start ( )

Definition at line 51 of file timer.cpp.

◆ stop()

void Timer::stop ( )

Definition at line 61 of file timer.cpp.

Member Data Documentation

◆ end_count_

timeval tue::Timer::end_count_
private

End counter.

Definition at line 121 of file timer.h.

◆ running_

bool tue::Timer::running_
private

Running flag.

Definition at line 95 of file timer.h.

◆ start_count_

timeval tue::Timer::start_count_
private

Start counter.

Definition at line 116 of file timer.h.


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