summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/ardour/dsp_load_calculator.h9
-rw-r--r--libs/pbd/cpus.cc8
2 files changed, 16 insertions, 1 deletions
diff --git a/libs/ardour/ardour/dsp_load_calculator.h b/libs/ardour/ardour/dsp_load_calculator.h
index c7c0c0b83e..88b327bb30 100644
--- a/libs/ardour/ardour/dsp_load_calculator.h
+++ b/libs/ardour/ardour/dsp_load_calculator.h
@@ -19,6 +19,7 @@
#ifndef ARDOUR_DSP_LOAD_CALCULATOR_H
#define ARDOUR_DSP_LOAD_CALCULATOR_H
+#include <stdlib.h>
#include <stdint.h>
#include <cassert>
#include <algorithm>
@@ -68,8 +69,14 @@ public:
return;
}
+#ifndef NDEBUG
+ const bool calc_avg_load = NULL != getenv("AVGLOAD");
+#else
+ const bool calc_avg_load = false;
+#endif
+
const float load = (float) elapsed_time_us() / (float)m_max_time_us;
- if (load > m_dsp_load || load > 1.0) {
+ if ((calc_avg_load && load > .95f) || (!calc_avg_load && (load > m_dsp_load || load > 1.f))) {
m_dsp_load = load;
} else {
const float alpha = 0.2f * (m_max_time_us * 1e-6f);
diff --git a/libs/pbd/cpus.cc b/libs/pbd/cpus.cc
index 69421e5e92..f43b128da1 100644
--- a/libs/pbd/cpus.cc
+++ b/libs/pbd/cpus.cc
@@ -22,6 +22,8 @@
#include "libpbd-config.h"
#endif
+#include <stdlib.h>
+
#ifdef __linux__
#include <unistd.h>
#elif defined(__APPLE__) || defined(__FreeBSD__)
@@ -41,6 +43,12 @@
uint32_t
hardware_concurrency()
{
+ if (getenv("CONCURRENCY")) {
+ int c = atoi (getenv("CONCURRENCY"));
+ if (c > 0) {
+ return c;
+ }
+ }
#if defined(PTW32_VERSION) || defined(__hpux)
return pthread_num_processors_np();
#elif defined(__APPLE__)