tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
tracktion::graph::PerformanceMeasurement Class Reference

A timer for measuring performance of code. More...

#include "tracktion_PerformanceMeasurement.h"

Classes

struct  Statistics
 Holds the current statistics. More...
 

Public Member Functions

 PerformanceMeasurement (std::string counterName, int runsPerPrintout=100, bool printOnDestruction=true)
 Creates a PerformanceMeasurement object.
 
 ~PerformanceMeasurement ()
 Destructor.
 
void start () noexcept
 Starts timing.
 
bool stop ()
 Stops timing and prints out the results.
 
void printStatistics ()
 Dumps the current metrics to std::cout.
 
std::string getName () const
 Returns the name.
 
Statistics getStatistics () const
 Returns a copy of the current stats.
 
Statistics getStatisticsAndReset ()
 Returns a copy of the current stats, and resets the internal counter.
 

Detailed Description

A timer for measuring performance of code.

e.g.

PerformanceMeasurement pc ("fish", 50);
for (;;)
{
doSomethingFishy();
}
A timer for measuring performance of code.
RAII wrapper to start and stop a performance measurement.

In this example, the time of each period between calling start/stop will be measured and averaged over 50 runs, and the results logged to std::cout every 50 times round the loop.

Definition at line 130 of file tracktion_PerformanceMeasurement.h.

Constructor & Destructor Documentation

◆ PerformanceMeasurement()

tracktion::graph::PerformanceMeasurement::PerformanceMeasurement ( std::string  counterName,
int  runsPerPrintout = 100,
bool  printOnDestruction = true 
)

Creates a PerformanceMeasurement object.

Parameters
counterNamethe name used when printing out the statistics
runsPerPrintoutthe number of start/stop iterations before calling printStatistics()

Definition at line 251 of file tracktion_PerformanceMeasurement.h.

◆ ~PerformanceMeasurement()

tracktion::graph::PerformanceMeasurement::~PerformanceMeasurement ( )

Destructor.

Definition at line 256 of file tracktion_PerformanceMeasurement.h.

Member Function Documentation

◆ getName()

std::string tracktion::graph::PerformanceMeasurement::getName ( ) const

Returns the name.

Definition at line 372 of file tracktion_PerformanceMeasurement.h.

◆ getStatistics()

PerformanceMeasurement::Statistics tracktion::graph::PerformanceMeasurement::getStatistics ( ) const

Returns a copy of the current stats.

Definition at line 377 of file tracktion_PerformanceMeasurement.h.

◆ getStatisticsAndReset()

PerformanceMeasurement::Statistics tracktion::graph::PerformanceMeasurement::getStatisticsAndReset ( )

Returns a copy of the current stats, and resets the internal counter.

Definition at line 382 of file tracktion_PerformanceMeasurement.h.

◆ printStatistics()

void tracktion::graph::PerformanceMeasurement::printStatistics ( )

Dumps the current metrics to std::cout.

Definition at line 366 of file tracktion_PerformanceMeasurement.h.

◆ start()

void tracktion::graph::PerformanceMeasurement::start ( )
noexcept

Starts timing.

See also
stop

Definition at line 343 of file tracktion_PerformanceMeasurement.h.

◆ stop()

bool tracktion::graph::PerformanceMeasurement::stop ( )

Stops timing and prints out the results.

The number of iterations before doing a printout of the results is set in the constructor.

See also
start

Definition at line 349 of file tracktion_PerformanceMeasurement.h.


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