LMMS
Loading...
Searching...
No Matches
juce::AudioProcessLoadMeasurer Class Reference

#include <juce_AudioProcessLoadMeasurer.h>

Classes

struct  ScopedTimer

Public Member Functions

 AudioProcessLoadMeasurer ()
 ~AudioProcessLoadMeasurer ()
void reset ()
void reset (double sampleRate, int blockSize)
double getLoadAsProportion () const
double getLoadAsPercentage () const
int getXRunCount () const
void registerBlockRenderTime (double millisecondsTaken)
void registerRenderTime (double millisecondsTaken, int numSamples)

Private Member Functions

void registerRenderTimeLocked (double, int)

Private Attributes

SpinLock mutex
int samplesPerBlock = 0
double msPerSample = 0
std::atomic< double > cpuUsageProportion { 0 }
std::atomic< intxruns { 0 }

Detailed Description

Maintains an ongoing measurement of the proportion of time which is being spent inside an audio callback.

@tags{Audio}

Constructor & Destructor Documentation

◆ AudioProcessLoadMeasurer()

juce::AudioProcessLoadMeasurer::AudioProcessLoadMeasurer ( )
default

◆ ~AudioProcessLoadMeasurer()

juce::AudioProcessLoadMeasurer::~AudioProcessLoadMeasurer ( )
default

Destructor.

Member Function Documentation

◆ getLoadAsPercentage()

double juce::AudioProcessLoadMeasurer::getLoadAsPercentage ( ) const

Returns the current load as a percentage 0 to 100.0

◆ getLoadAsProportion()

double juce::AudioProcessLoadMeasurer::getLoadAsProportion ( ) const

Returns the current load as a proportion 0 to 1.0

◆ getXRunCount()

int juce::AudioProcessLoadMeasurer::getXRunCount ( ) const

Returns the number of over- (or under-) runs recorded since the state was reset.

◆ registerBlockRenderTime()

void juce::AudioProcessLoadMeasurer::registerBlockRenderTime ( double millisecondsTaken)

Can be called manually to add the time of a callback to the stats. Normally you probably would never call this - it's simpler and more robust to use a ScopedTimer to measure the time using an RAII pattern.

◆ registerRenderTime()

void juce::AudioProcessLoadMeasurer::registerRenderTime ( double millisecondsTaken,
int numSamples )

Can be called manually to add the time of a callback to the stats. Normally you probably would never call this - it's simpler and more robust to use a ScopedTimer to measure the time using an RAII pattern.

◆ registerRenderTimeLocked()

void juce::AudioProcessLoadMeasurer::registerRenderTimeLocked ( double milliseconds,
int numSamples )
private

◆ reset() [1/2]

void juce::AudioProcessLoadMeasurer::reset ( )

Resets the state.

◆ reset() [2/2]

void juce::AudioProcessLoadMeasurer::reset ( double sampleRate,
int blockSize )

Resets the counter, in preparation for use with the given sample rate and block size.

Member Data Documentation

◆ cpuUsageProportion

std::atomic<double> juce::AudioProcessLoadMeasurer::cpuUsageProportion { 0 }
private

◆ msPerSample

double juce::AudioProcessLoadMeasurer::msPerSample = 0
private

◆ mutex

SpinLock juce::AudioProcessLoadMeasurer::mutex
private

◆ samplesPerBlock

int juce::AudioProcessLoadMeasurer::samplesPerBlock = 0
private

◆ xruns

std::atomic<int> juce::AudioProcessLoadMeasurer::xruns { 0 }
private

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