OpenVDB  5.2.0
Public Member Functions | List of all members
CpuTimer Class Reference

Simple timer for basic profiling. More...

#include <CpuTimer.h>

Public Member Functions

 CpuTimer ()
 Initiate timer. More...
 
 CpuTimer (const std::string &msg)
 Prints message and re-start timer. More...
 
void start ()
 Start timer. More...
 
void start (const std::string &msg)
 Print message and re-start timer. More...
 
void restart (const std::string &msg)
 Stop previous timer, print message and re-start timer. More...
 
double delta () const
 Return Time diference in milliseconds since construction or start was called. More...
 
void stop () const
 Print time in milliseconds since construction or start was called. More...
 

Detailed Description

Simple timer for basic profiling.

CpuTimer timer;
// code here will not be timed!
timer.start("algorithm");
// code to be timed goes here
timer.stop();

or to time multiple blocks of code

CpuTimer timer("algorithm 1");
// code to be timed goes here
timer.restart("algorithm 2");
// code to be timed goes here
timer.stop();

Constructor & Destructor Documentation

CpuTimer ( )
inline

Initiate timer.

CpuTimer ( const std::string &  msg)
inline

Prints message and re-start timer.

Note
Should normally be followed by a call to stop()

Member Function Documentation

double delta ( ) const
inline

Return Time diference in milliseconds since construction or start was called.

void restart ( const std::string &  msg)
inline

Stop previous timer, print message and re-start timer.

Note
Should normally be followed by a call to stop()
void start ( )
inline

Start timer.

Note
Should normally be followed by a call to time()
void start ( const std::string &  msg)
inline

Print message and re-start timer.

Note
Should normally be followed by a call to stop()
void stop ( ) const
inline

Print time in milliseconds since construction or start was called.


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