Allow to investigate I/O thread policy
see https://discourse.ardour.org/t/ardour-8-7-unable-to-connect-to-audio-backend/110774/10 https://discourse.ardour.org/t/ardour-8-7-x-run-issues/110767/2
This commit is contained in:
parent
6cc54aa1b0
commit
9945d7721f
@ -52,19 +52,38 @@ IOTaskList::IOTaskList (uint32_t n_threads)
|
||||
|
||||
pthread_attr_t attr;
|
||||
struct sched_param parm;
|
||||
parm.sched_priority = pbd_absolute_rt_priority (SCHED_RR, pbd_pthread_priority (THREAD_IO));
|
||||
|
||||
pthread_attr_init (&attr);
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
pthread_attr_setschedpolicy (&attr, SCHED_OTHER);
|
||||
#else
|
||||
pthread_attr_setschedpolicy (&attr, SCHED_RR);
|
||||
#endif
|
||||
pthread_attr_setschedparam (&attr, &parm);
|
||||
pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
pthread_attr_setinheritsched (&attr, PTHREAD_EXPLICIT_SCHED);
|
||||
|
||||
DEBUG_TRACE (PBD::DEBUG::IOTaskList, string_compose ("IOTaskList starting %1 threads with priority = %2\n", _n_threads, parm.sched_priority));
|
||||
bool use_sched_param = true;
|
||||
int policy = SCHED_RR;
|
||||
|
||||
const char* p = getenv ("ARDOUR_IO_SCHED");
|
||||
if (p) {
|
||||
int pi = atoi (p);
|
||||
if (pi < 0) {
|
||||
policy = SCHED_RR;
|
||||
} else if (pi > 0) {
|
||||
policy = SCHED_FIFO;
|
||||
} else {
|
||||
use_sched_param = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (use_sched_param) {
|
||||
parm.sched_priority = pbd_absolute_rt_priority (SCHED_RR, pbd_pthread_priority (THREAD_IO));
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
pthread_attr_setschedpolicy (&attr, SCHED_OTHER);
|
||||
#else
|
||||
pthread_attr_setschedpolicy (&attr, policy);
|
||||
#endif
|
||||
pthread_attr_setschedparam (&attr, &parm);
|
||||
pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
pthread_attr_setinheritsched (&attr, PTHREAD_EXPLICIT_SCHED);
|
||||
DEBUG_TRACE (PBD::DEBUG::IOTaskList, string_compose ("IOTaskList starting %1 threads with priority = %2, policy = %3\n", _n_threads, parm.sched_priority, policy));
|
||||
} else {
|
||||
DEBUG_TRACE (PBD::DEBUG::IOTaskList, string_compose ("IOTaskList starting %1 threads with default priority.\n", _n_threads));
|
||||
}
|
||||
|
||||
_workers.resize (_n_threads);
|
||||
for (uint32_t i = 0; i < _n_threads; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user