Add method to set thread_local _thread_sample_rate complete with debugging output
This commit is contained in:
parent
b06b856934
commit
8bd465fc61
@ -16,9 +16,23 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#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';
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user