26AudioProcessLoadMeasurer::AudioProcessLoadMeasurer() =
default;
38 cpuUsageProportion = 0;
41 samplesPerBlock = blockSize;
42 msPerSample = (sampleRate > 0.0 && blockSize > 0) ? 1000.0 / sampleRate : 0;
50 registerRenderTimeLocked (milliseconds, samplesPerBlock);
58 registerRenderTimeLocked (milliseconds, numSamples);
61void AudioProcessLoadMeasurer::registerRenderTimeLocked (
double milliseconds,
int numSamples)
82 : ScopedTimer (p, p.samplesPerBlock)
86AudioProcessLoadMeasurer::ScopedTimer::ScopedTimer (AudioProcessLoadMeasurer& p,
int numSamplesInBlock)
87 : owner (p), startTime (Time::getMillisecondCounterHiRes()), samplesInBlock (
numSamplesInBlock)
94AudioProcessLoadMeasurer::ScopedTimer::~ScopedTimer()
Maintains an ongoing measurement of the proportion of time which is being spent inside an audio callb...
~AudioProcessLoadMeasurer()
Destructor.
double getLoadAsPercentage() const
Returns the current load as a percentage 0 to 100.0.
void registerBlockRenderTime(double millisecondsTaken)
Can be called manually to add the time of a callback to the stats.
void registerRenderTime(double millisecondsTaken, int numSamples)
Can be called manually to add the time of a callback to the stats.
int getXRunCount() const
Returns the number of over- (or under-) runs recorded since the state was reset.
void reset()
Resets the state.
double getLoadAsProportion() const
Returns the current load as a proportion 0 to 1.0.
Automatically locks and unlocks a mutex object.
Automatically locks and unlocks a mutex object.
static double getMillisecondCounterHiRes() noexcept
Returns the number of millisecs since a fixed event (usually system startup).
constexpr bool approximatelyEqual(Type a, Type b, Tolerance< Type > tolerance=Tolerance< Type >{} .withAbsolute(std::numeric_limits< Type >::min()) .withRelative(std::numeric_limits< Type >::epsilon()))
Returns true if the two floating-point numbers are approximately equal.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...