Add RT thread priority debugging
This commit is contained in:
parent
87fdec1c51
commit
8115578d4e
@ -76,7 +76,7 @@ IOTaskList::IOTaskList (uint32_t n_threads)
|
||||
|
||||
_workers.resize (_n_threads);
|
||||
for (uint32_t i = 0; i < _n_threads; ++i) {
|
||||
if (!use_rt || pbd_realtime_pthread_create (policy, PBD_RT_PRI_IOFX, 0, &_workers[i], &_worker_thread, this)) {
|
||||
if (!use_rt || pbd_realtime_pthread_create ("I/O", policy, PBD_RT_PRI_IOFX, 0, &_workers[i], &_worker_thread, this)) {
|
||||
if (use_rt && i == 0) {
|
||||
PBD::warning << _("IOTaskList: cannot acquire realtime permissions.") << endmsg;
|
||||
}
|
||||
|
@ -952,7 +952,7 @@ AlsaAudioBackend::_start (bool for_latency_measurement)
|
||||
_run = true;
|
||||
_port_change_flag.store (0);
|
||||
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC,
|
||||
if (pbd_realtime_pthread_create ("ALSA Main", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC,
|
||||
&_main_thread, pthread_process, this)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) {
|
||||
PBD::error << _("AlsaAudioBackend: failed to create process thread.") << endmsg;
|
||||
@ -1152,7 +1152,7 @@ AlsaAudioBackend::create_process_thread (boost::function<void ()> func)
|
||||
pthread_t thread_id;
|
||||
ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC);
|
||||
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, alsa_process_thread, td)) {
|
||||
if (pbd_realtime_pthread_create ("ALSA Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, alsa_process_thread, td)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, alsa_process_thread, td)) {
|
||||
PBD::error << _("AudioEngine: cannot create process thread.") << endmsg;
|
||||
return -1;
|
||||
|
@ -73,7 +73,7 @@ static void * pthread_process (void *arg)
|
||||
int
|
||||
AlsaMidiIO::start ()
|
||||
{
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP,
|
||||
if (pbd_realtime_pthread_create ("ALSA MIDI", PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP,
|
||||
&_main_thread, pthread_process, this))
|
||||
{
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_HELP, &_main_thread, pthread_process, this)) {
|
||||
|
@ -111,7 +111,7 @@ AlsaAudioSlave::start ()
|
||||
}
|
||||
|
||||
_run = true;
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_HELP,
|
||||
if (pbd_realtime_pthread_create ("ALSA Slave", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_HELP,
|
||||
&_thread, _process_thread, this))
|
||||
{
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_HELP, &_thread, _process_thread, this)) {
|
||||
|
@ -829,7 +829,7 @@ CoreAudioBackend::create_process_thread (boost::function<void()> func)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC,
|
||||
if (pbd_realtime_pthread_create ("CoreAudio Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC,
|
||||
&thread_id, coreaudio_process_thread, td)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, coreaudio_process_thread, td)) {
|
||||
PBD::error << _("AudioEngine: cannot create process thread.") << endmsg;
|
||||
|
@ -431,7 +431,7 @@ DummyAudioBackend::_start (bool /*for_latency_measurement*/)
|
||||
_port_change_flag.store (0);
|
||||
|
||||
bool ok = _realtime;
|
||||
if (_realtime && pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) {
|
||||
if (_realtime && pbd_realtime_pthread_create ("Dummy Main", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) {
|
||||
PBD::warning << _("DummyAudioBackend: failed to acquire realtime permissions.") << endmsg;
|
||||
ok = false;
|
||||
}
|
||||
@ -529,7 +529,7 @@ DummyAudioBackend::create_process_thread (boost::function<void()> func)
|
||||
pthread_t thread_id;
|
||||
ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC);
|
||||
|
||||
bool ok = _realtime && 0 == pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, dummy_process_thread, td);
|
||||
bool ok = _realtime && 0 == pbd_realtime_pthread_create ("Dummy Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, dummy_process_thread, td);
|
||||
if (!ok && pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, dummy_process_thread, td)) {
|
||||
PBD::error << _("AudioEngine: cannot create process thread.") << endmsg;
|
||||
return -1;
|
||||
|
@ -775,7 +775,7 @@ PortAudioBackend::process_callback(const float* input,
|
||||
bool
|
||||
PortAudioBackend::start_blocking_process_thread ()
|
||||
{
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC,
|
||||
if (pbd_realtime_pthread_create ("PortAudio Main", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC,
|
||||
&_main_blocking_thread, blocking_thread_func, this))
|
||||
{
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &_main_blocking_thread, blocking_thread_func, this))
|
||||
@ -1103,7 +1103,7 @@ PortAudioBackend::create_process_thread (boost::function<void()> func)
|
||||
pthread_t thread_id;
|
||||
ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC);
|
||||
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC,
|
||||
if (pbd_realtime_pthread_create ("PortAudio Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC,
|
||||
&thread_id, portaudio_process_thread, td)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, portaudio_process_thread, td)) {
|
||||
DEBUG_AUDIO("Cannot create process thread.");
|
||||
|
@ -230,7 +230,7 @@ WinMMEMidiOutputDevice::start_midi_output_thread ()
|
||||
m_thread_quit = false;
|
||||
|
||||
// TODO Use native threads
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP,
|
||||
if (pbd_realtime_pthread_create ("WinMME Output", PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP,
|
||||
&m_output_thread_handle, midi_output_thread, this)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ PulseAudioBackend::_start (bool /*for_latency_measurement*/)
|
||||
_run = true;
|
||||
_port_change_flag.store (0);
|
||||
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC,
|
||||
if (pbd_realtime_pthread_create ("PulseAudio Main", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC,
|
||||
&_main_thread, pthread_process, this)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) {
|
||||
PBD::error << _("PulseAudioBackend: failed to create process thread.") << endmsg;
|
||||
@ -703,7 +703,7 @@ PulseAudioBackend::create_process_thread (boost::function<void()> func)
|
||||
pthread_t thread_id;
|
||||
ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC);
|
||||
|
||||
if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC,
|
||||
if (pbd_realtime_pthread_create ("PulseAudio Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC,
|
||||
&thread_id, pulse_process_thread, td)) {
|
||||
if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, pulse_process_thread, td)) {
|
||||
PBD::error << _("AudioEngine: cannot create process thread.") << endmsg;
|
||||
|
@ -87,6 +87,7 @@ LIBPBD_API int pbd_pthread_create (
|
||||
|
||||
|
||||
LIBPBD_API int pbd_realtime_pthread_create (
|
||||
std::string const& debug_name,
|
||||
const int policy, int priority, const size_t stacksize,
|
||||
pthread_t *thread,
|
||||
void *(*start_routine) (void *),
|
||||
|
@ -396,6 +396,7 @@ pbd_absolute_rt_priority (int policy, int priority)
|
||||
|
||||
int
|
||||
pbd_realtime_pthread_create (
|
||||
std::string const& debug_name,
|
||||
const int policy, int priority, const size_t stacksize,
|
||||
pthread_t* thread,
|
||||
void* (*start_routine) (void*),
|
||||
@ -416,7 +417,7 @@ pbd_realtime_pthread_create (
|
||||
if (stacksize > 0) {
|
||||
pthread_attr_setstacksize (&attr, stacksize + pbd_stack_size ());
|
||||
}
|
||||
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Start Realtime Thread policy = %1 priority = %2 stacksize = 0x%3%4\n", policy, parm.sched_priority, std::hex, stacksize));
|
||||
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Start RT Thread: '%1' policy = %2 priority = %3 stacksize = 0x%4%5\n", debug_name, policy, parm.sched_priority, std::hex, stacksize));
|
||||
rv = pthread_create (thread, &attr, start_routine, arg);
|
||||
pthread_attr_destroy (&attr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user