RobWorkProject  23.9.11-
Classes | Public Member Functions | Static Public Member Functions | List of all members
CodeTimer Class Reference

This class can be used to test how much time is used when executing a part of the code. More...

#include <CodeTimer.hpp>

Public Member Functions

 CodeTimer (std::string name="CodeTimer")
 Register a new code time ounde the name name. if name already exists then add the time from this execution to the a label and increment the amount of times this label has been called. More...
 
virtual ~CodeTimer ()
 calls stop();
 
void operator() (std::string newName)
 Stops the time and starts it under a new label. More...
 
void stop ()
 stop the code timer. if Print outs enabled print the time, else store the result in the static repport.
 
void stopAndStartWithName (std::string name)
 Stop the Current Time, and restart it with a new name. More...
 

Static Public Member Functions

static void getRepport ()
 Get the Repport object.
 
static void enablePrintOuts (bool enable)
 enable or disable printouts when stop is called on a global level More...
 

Detailed Description

This class can be used to test how much time is used when executing a part of the code.

Constructor & Destructor Documentation

◆ CodeTimer()

CodeTimer ( std::string  name = "CodeTimer")

Register a new code time ounde the name name. if name already exists then add the time from this execution to the a label and increment the amount of times this label has been called.

OBS this code is not multthread friendly, so only create instances of this class in a single thread

Parameters
namename of the code label

Member Function Documentation

◆ enablePrintOuts()

static void enablePrintOuts ( bool  enable)
static

enable or disable printouts when stop is called on a global level

Parameters
enable

◆ operator()()

void operator() ( std::string  newName)

Stops the time and starts it under a new label.

Parameters
newNamenew label

◆ stopAndStartWithName()

void stopAndStartWithName ( std::string  name)

Stop the Current Time, and restart it with a new name.

Parameters
name

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