JUCE  v5.1.1-3-g1a0b28c73
JUCE API
ScopedTimeMeasurement Class Reference

Simple RAII class for measuring the time spent in a scope. More...

#include <juce_PerformanceCounter.h>

Collaboration diagram for ScopedTimeMeasurement:

Public Member Functions

 ScopedTimeMeasurement (double &resultInSeconds)
 
 ~ScopedTimeMeasurement ()
 

Private Attributes

double & result
 
int64 startTimeTicks = Time::getHighResolutionTicks()
 

Detailed Description

Simple RAII class for measuring the time spent in a scope.

Example:

{ double timeSec;

{ ScopedTimeMeasurement m (timeSec); doSomething(); }

Logger::writeToLog (String ("doSomething() took ") + String (timeSec) + "seconds"); }

Parameters
resultInSecondsThe result of the measurement will be stored in this variable.

Constructor & Destructor Documentation

◆ ScopedTimeMeasurement()

ScopedTimeMeasurement::ScopedTimeMeasurement ( double &  resultInSeconds)
inline

◆ ~ScopedTimeMeasurement()

ScopedTimeMeasurement::~ScopedTimeMeasurement ( )
inline

Member Data Documentation

◆ result

double& ScopedTimeMeasurement::result
private

◆ startTimeTicks

int64 ScopedTimeMeasurement::startTimeTicks = Time::getHighResolutionTicks()
private

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