diff --git a/libs/temporal/superclock.cc b/libs/temporal/superclock.cc index d98883f996..eb46364d92 100644 --- a/libs/temporal/superclock.cc +++ b/libs/temporal/superclock.cc @@ -16,9 +16,23 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + +#include +#include + +#include "pbd/pthread_utils.h" + #include "temporal/superclock.h" namespace Temporal { thread_local uint32_t _thread_sample_rate = 0; } +void +Temporal::set_thread_sample_rate (uint32_t sr) +{ + _thread_sample_rate = sr; + std::cout << pthread_name() << " 0x" << std::hex << pthread_self() << std::dec << " TID " << syscall(SYS_gettid) << " set TSR @ " << &_thread_sample_rate << " to " << sr << " = " << _thread_sample_rate << '\n'; +} + diff --git a/libs/temporal/temporal/superclock.h b/libs/temporal/temporal/superclock.h index d42dd2bcdc..369aed174a 100644 --- a/libs/temporal/temporal/superclock.h +++ b/libs/temporal/temporal/superclock.h @@ -35,6 +35,7 @@ static inline superclock_t samples_to_superclock (int samples, int sr) { return /* this needs to be updated per-thread at a suitable time */ extern thread_local uint32_t _thread_sample_rate; +void set_thread_sample_rate (uint32_t sr); }