OpenVDB: CpuTimer Class Reference

OpenVDB 4.0.2

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() [1/2]

CpuTimer | ( |  | ) |
| inline

Initiate timer.

## ◆ CpuTimer() [2/2]

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

## ◆ delta()

double delta | ( |  | ) | const
| inline

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

## ◆ restart()

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()

## ◆ start() [1/2]

void start | ( |  | ) |
| inline

Start timer.

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

## ◆ start() [2/2]

void start | ( | const std::string & | msg | ) |
| inline

Print message and re-start timer.

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

## ◆ 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:

- CpuTimer.h