Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::Timer Class Reference

Platform independent milli/micro/nanosecond timerThis class implements a simple cross-platform timer with nanosecond resolution. It operates similarly to a good stop watch: it can be started and stopped and records both the time since the last start() invocation, and the total time collected in separate intervals. More...

#include <mitsuba/core/timer.h>

+ Inheritance diagram for mitsuba::Timer:

Public Member Functions

 Timer (bool start=true)
 Create a new timer and start it unless the optional start argument is set to false. More...
 
void start ()
 Start the timer. More...
 
void reset (bool restart=true)
 Reset the timer, including the total elapsed time across all intervals (and restart it by default) More...
 
Float stop ()
 Stop the timer and return the total elapsed time across all intervals in seconds. More...
 
uint64_t getNanoseconds () const
 Return the number of nanoseconds that the timer has ticked so far (in total) More...
 
unsigned int getMicroseconds () const
 Return the number of microseconds that the timer has ticked so far (in total) More...
 
unsigned int getMilliseconds () const
 Return the number of milliseconds that the timer has ticked so far (in total) More...
 
Float getSeconds () const
 Return the number of seconds that the timer has ticked so far (in total) More...
 
uint64_t getNanosecondsSinceStart () const
 Return the number of nanoseconds that have elapsed since the start() invocation. More...
 
unsigned int getMicrosecondsSinceStart () const
 Return the number of microseconds that have elapsed since the last start() invocation. More...
 
unsigned int getMillisecondsSinceStart () const
 Return the number of milliseconds that have elapsed since the last start() invocation. More...
 
Float getSecondsSinceStart () const
 Return the number of seconds that have elapsed since the last start() invocation. More...
 
Float lap ()
 "Lap"-style interface More...
 
std::string toString () const
 Return a string representation. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~Timer ()
 Virtual destructor. More...
 
double timeSinceStart () const
 Return the time in nanoseconds since the last start() invocation. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Detailed Description

Platform independent milli/micro/nanosecond timer

This class implements a simple cross-platform timer with nanosecond resolution. It operates similarly to a good stop watch: it can be started and stopped and records both the time since the last start() invocation, and the total time collected in separate intervals.

Author
Edgar Velazquez-Armendariz

Constructor & Destructor Documentation

mitsuba::Timer::Timer ( bool  start = true)

Create a new timer and start it unless the optional start argument is set to false.

virtual mitsuba::Timer::~Timer ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

virtual const Class* mitsuba::Timer::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

unsigned int mitsuba::Timer::getMicroseconds ( ) const

Return the number of microseconds that the timer has ticked so far (in total)

unsigned int mitsuba::Timer::getMicrosecondsSinceStart ( ) const

Return the number of microseconds that have elapsed since the last start() invocation.

unsigned int mitsuba::Timer::getMilliseconds ( ) const

Return the number of milliseconds that the timer has ticked so far (in total)

unsigned int mitsuba::Timer::getMillisecondsSinceStart ( ) const

Return the number of milliseconds that have elapsed since the last start() invocation.

uint64_t mitsuba::Timer::getNanoseconds ( ) const

Return the number of nanoseconds that the timer has ticked so far (in total)

uint64_t mitsuba::Timer::getNanosecondsSinceStart ( ) const

Return the number of nanoseconds that have elapsed since the start() invocation.

Float mitsuba::Timer::getSeconds ( ) const

Return the number of seconds that the timer has ticked so far (in total)

Float mitsuba::Timer::getSecondsSinceStart ( ) const

Return the number of seconds that have elapsed since the last start() invocation.

Float mitsuba::Timer::lap ( )

"Lap"-style interface

This function is the atomic equivalent to stopping the timer, recording the time passed since it was started, and restarting it. The resulting time value in seconds is returned.

void mitsuba::Timer::reset ( bool  restart = true)

Reset the timer, including the total elapsed time across all intervals (and restart it by default)

void mitsuba::Timer::start ( )

Start the timer.

Float mitsuba::Timer::stop ( )

Stop the timer and return the total elapsed time across all intervals in seconds.

double mitsuba::Timer::timeSinceStart ( ) const
protected

Return the time in nanoseconds since the last start() invocation.

std::string mitsuba::Timer::toString ( ) const
virtual

Return a string representation.

Reimplemented from Object.

Member Data Documentation

Class* mitsuba::Timer::m_theClass
static

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