removing thread prioritization for writer, streamer and tcp threads

This commit is contained in:
Dhanya Maliakal 2017-05-16 14:45:48 +02:00
parent a182ca3660
commit 001d6415bf
5 changed files with 21 additions and 12 deletions

View File

@ -41,7 +41,7 @@
#define DUMMY_PACKET_VALUE 0xFFFFFFFF
#define LISTENER_PRIORITY 99
#define PROCESSOR_PRIORITY 90
#define STREAMER_PRIORITY 80
#define TCP_PRIORITY 50
#define LISTENER_PRIORITY 90
#define PROCESSOR_PRIORITY 70
#define STREAMER_PRIORITY 10
#define TCP_PRIORITY 10

View File

@ -187,8 +187,9 @@ void DataProcessor::SetGeneralData(GeneralData* g) {
int DataProcessor::SetThreadPriority(int priority) {
struct sched_param param;
param.sched_priority = priority;
if (pthread_setschedparam(thread, SCHED_RR, &param) == EPERM)
if (pthread_setschedparam(thread, SCHED_FIFO, &param) == EPERM)
return FAIL;
FILE_LOG(logINFO) << "Processor Thread Priority set to " << priority;
return OK;
}

View File

@ -151,8 +151,9 @@ void DataStreamer::SetGeneralData(GeneralData* g) {
int DataStreamer::SetThreadPriority(int priority) {
struct sched_param param;
param.sched_priority = priority;
if (pthread_setschedparam(thread, SCHED_RR, &param) == EPERM)
if (pthread_setschedparam(thread, SCHED_FIFO, &param) == EPERM)
return FAIL;
FILE_LOG(logINFO) << "Streamer Thread Priority set to " << priority;
return OK;
}

View File

@ -187,8 +187,9 @@ void Listener::SetGeneralData(GeneralData*& g) {
int Listener::SetThreadPriority(int priority) {
struct sched_param param;
param.sched_priority = priority;
if (pthread_setschedparam(thread, SCHED_RR, &param) == EPERM)
if (pthread_setschedparam(thread, SCHED_FIFO, &param) == EPERM)
return FAIL;
FILE_LOG(logINFO) << "Listener Thread Priority set to " << priority;
return OK;
}

View File

@ -644,37 +644,43 @@ void UDPStandardImplementation::SetThreadPriorities() {
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
if ((*it)->SetThreadPriority(LISTENER_PRIORITY) == FAIL) {
FILE_LOG(logWARNING) << "No root privileges to prioritize threads";
FILE_LOG(logWARNING) << "No root privileges to prioritize listener threads";
return;
}
}
/*
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
if ((*it)->SetThreadPriority(PROCESSOR_PRIORITY) == FAIL) {
FILE_LOG(logWARNING) << "No root privileges to prioritize threads";
FILE_LOG(logWARNING) << "No root privileges to prioritize writer threads";
return;
}
}
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
if ((*it)->SetThreadPriority(STREAMER_PRIORITY) == FAIL) {
FILE_LOG(logWARNING) << "No root privileges to prioritize threads";
FILE_LOG(logWARNING) << "No root privileges to prioritize streamer threads";
return;
}
}
struct sched_param tcp_param;
tcp_param.sched_priority = TCP_PRIORITY;
if (pthread_setschedparam(pthread_self(),5 , &tcp_param) != EPERM) {
FILE_LOG(logWARNING) << "No root privileges to prioritize threads";
FILE_LOG(logWARNING) << "No root privileges to prioritize tcp threads";
return;
}
ostringstream osfn;
osfn << "Priorities set - "
osfn << "Priorities set - "
"TCP:"<< TCP_PRIORITY <<
", Listener:" << LISTENER_PRIORITY <<
", Processor:" << PROCESSOR_PRIORITY;
if (dataStreamEnable)
osfn << ", Streamer:" << STREAMER_PRIORITY;
*/
ostringstream osfn;
osfn << "Priorities set - "
"Listener:" << LISTENER_PRIORITY;
FILE_LOG(logINFO) << osfn.str();
}