Ember
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
PerfTimer Class Reference

A high-resolution, thread-aware timer and call counter class. More...

#include <perfTimer.h>

Public Member Functions

 PerfTimer ()
 
 ~PerfTimer ()
 
void start ()
 Start accumulating time, and increment the call counter.
 
void stop ()
 Stop accumulating time.
 
void reset ()
 Reset the accumulated time.
 
void resume ()
 Starts accumulating time without incrementing callCount.
 
double getTime () const
 Get the elapsed time in seconds.
 
unsigned long int getCallCount () const
 Get the total call count.
 

Private Attributes

tbb::combinable< unsigned long int > callCount
 
tbb::combinable< unsigned long int > cumulativeTime
 
tbb::enumerable_thread_specific< timeval > t1
 

Detailed Description

A high-resolution, thread-aware timer and call counter class.

Uses OS- specific timers to get better precision (typically microsecond or better resolution) than the cross- platform clock function which typically has a resolution on the order of 10 ms. Multiple threads may independently start() and stop() the same timer. The reported elapsed time will be the sum of the elapsed time from each thread.

Constructor & Destructor Documentation

◆ PerfTimer()

PerfTimer::PerfTimer ( )

◆ ~PerfTimer()

PerfTimer::~PerfTimer ( )
inline

Member Function Documentation

◆ start()

void PerfTimer::start ( )

Start accumulating time, and increment the call counter.

◆ stop()

void PerfTimer::stop ( )

Stop accumulating time.

◆ reset()

void PerfTimer::reset ( )

Reset the accumulated time.

◆ resume()

void PerfTimer::resume ( )

Starts accumulating time without incrementing callCount.

◆ getTime()

double PerfTimer::getTime ( ) const

Get the elapsed time in seconds.

◆ getCallCount()

unsigned long PerfTimer::getCallCount ( ) const

Get the total call count.

Member Data Documentation

◆ callCount

tbb::combinable<unsigned long int> PerfTimer::callCount
private

◆ cumulativeTime

tbb::combinable<unsigned long int> PerfTimer::cumulativeTime
private

◆ t1

tbb::enumerable_thread_specific<timeval> PerfTimer::t1
private

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