Biorbd Release_1.13.0
Loading...
Searching...
No Matches
BIORBD_NAMESPACE::utils::Benchmark Class Reference

Collection of method to supercifically benchmark the code. More...

#include <Benchmark.h>

Public Member Functions

 Benchmark ()
 Construct a benchmark analysis.
void startTimer (const String &name, bool force=false)
 Start the timer of a specified name.
void pauseTimer (const String &name)
 Pause a timer of a specified name.
void resumeTimer (const String &name)
 Resume a timer of a specified name.
double getLap (const String &name)
 Get lap time of a specified timer.
double stopTimer (const String &name)
 Stop the timer of a specified name and get lap time.
void addTimer (const String &name)
 Add a new timer to the timer set.
int getTimerIdx (const String &name)
 Get the index of the specified timer.

Static Public Member Functions

static void wasteTime (double timeInSec)
 To waste time (similar to a sleep function).

Protected Attributes

std::map< String, Timer > m_timers
 Timers.
std::map< String, int > m_counts
 Counts.

Detailed Description

Collection of method to supercifically benchmark the code.

Benchmark can run multiple timers at the same time. One must simply gives different names

Definition at line 20 of file Benchmark.h.

Constructor & Destructor Documentation

◆ Benchmark()

utils::Benchmark::Benchmark ( )

Construct a benchmark analysis.

Definition at line 9 of file Benchmark.cpp.

Member Function Documentation

◆ addTimer()

void utils::Benchmark::addTimer ( const String & name)

Add a new timer to the timer set.

Parameters
nameThe name of the timer to add

Definition at line 37 of file Benchmark.cpp.

◆ getLap()

double utils::Benchmark::getLap ( const String & name)

Get lap time of a specified timer.

Parameters
nameName of the timer
Returns
The lap time of a specified timer

Definition at line 21 of file Benchmark.cpp.

◆ getTimerIdx()

int utils::Benchmark::getTimerIdx ( const String & name)

Get the index of the specified timer.

Parameters
nameThe name of the timer
Returns
The index of the specified timer

Definition at line 41 of file Benchmark.cpp.

◆ pauseTimer()

void utils::Benchmark::pauseTimer ( const String & name)

Pause a timer of a specified name.

Parameters
nameName of the timer to pause

Definition at line 29 of file Benchmark.cpp.

◆ resumeTimer()

void utils::Benchmark::resumeTimer ( const String & name)

Resume a timer of a specified name.

Parameters
nameName of the timer to resume

Definition at line 33 of file Benchmark.cpp.

◆ startTimer()

void utils::Benchmark::startTimer ( const String & name,
bool force = false )

Start the timer of a specified name.

Parameters
nameThe name to associate with timer
forceIf force is true, the timer starts even though it is already started

Definition at line 13 of file Benchmark.cpp.

◆ stopTimer()

double utils::Benchmark::stopTimer ( const String & name)

Stop the timer of a specified name and get lap time.

Parameters
nameName of the timer
Returns
The lap time of a specified timer

Definition at line 25 of file Benchmark.cpp.

◆ wasteTime()

void utils::Benchmark::wasteTime ( double timeInSec)
static

To waste time (similar to a sleep function).

Parameters
timeInSecTime in seconds to wait

Definition at line 45 of file Benchmark.cpp.

Member Data Documentation

◆ m_counts

std::map<String, int> BIORBD_NAMESPACE::utils::Benchmark::m_counts
protected

Counts.

Definition at line 82 of file Benchmark.h.

◆ m_timers

std::map<String, Timer> BIORBD_NAMESPACE::utils::Benchmark::m_timers
protected

Timers.

Definition at line 81 of file Benchmark.h.


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