From 1ed9564ffd2145ab290903d73a8cc774147c5432 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 4 Aug 2017 16:26:26 +0200 Subject: Graph profiling: allow to override max DSP thread count & calc avg. --- libs/ardour/ardour/dsp_load_calculator.h | 9 ++++++++- libs/pbd/cpus.cc | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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 #include #include #include @@ -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 + #ifdef __linux__ #include #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__) -- cgit v1.2.3