Browse Source

Improve headless performance by not querying unused meters

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.02
falkTX 3 years ago
parent
commit
0f66ba9b5b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      src/override/Engine.cpp

+ 14
- 0
src/override/Engine.cpp View File

@@ -73,6 +73,7 @@ struct Engine::Internal {
double blockTime = 0.0;
int blockFrames = 0;

#ifndef HEADLESS
// Meter
int meterCount = 0;
double meterTotal = 0.0;
@@ -80,6 +81,7 @@ struct Engine::Internal {
double meterLastTime = -INFINITY;
double meterLastAverage = 0.0;
double meterLastMax = 0.0;
#endif

// Parameter smoothing
Module* smoothModule = NULL;
@@ -306,8 +308,10 @@ void Engine::clear_NoLock() {


void Engine::stepBlock(int frames) {
#ifndef HEADLESS
// Start timer before locking
double startTime = system::getTime();
#endif

SharedLock<SharedMutex> lock(internal->mutex);
// Configure thread
@@ -330,6 +334,7 @@ void Engine::stepBlock(int frames) {

internal->block++;

#ifndef HEADLESS
// Stop timer
double endTime = system::getTime();
double meter = (endTime - startTime) / (frames * internal->sampleTime);
@@ -347,6 +352,7 @@ void Engine::stepBlock(int frames) {
internal->meterTotal = 0.0;
internal->meterMax = 0.0;
}
#endif
}


@@ -434,12 +440,20 @@ double Engine::getBlockDuration() {


double Engine::getMeterAverage() {
#ifndef HEADLESS
return internal->meterLastAverage;
#else
return 0.0;
#endif
}


double Engine::getMeterMax() {
#ifndef HEADLESS
return internal->meterLastMax;
#else
return 0.0;
#endif
}




Loading…
Cancel
Save