mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
removing thread prioritization for writer, streamer and tcp threads
This commit is contained in:
parent
a182ca3660
commit
001d6415bf
@ -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
|
||||
|
@ -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, ¶m) == EPERM)
|
||||
if (pthread_setschedparam(thread, SCHED_FIFO, ¶m) == EPERM)
|
||||
return FAIL;
|
||||
FILE_LOG(logINFO) << "Processor Thread Priority set to " << priority;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -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, ¶m) == EPERM)
|
||||
if (pthread_setschedparam(thread, SCHED_FIFO, ¶m) == EPERM)
|
||||
return FAIL;
|
||||
FILE_LOG(logINFO) << "Streamer Thread Priority set to " << priority;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -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, ¶m) == EPERM)
|
||||
if (pthread_setschedparam(thread, SCHED_FIFO, ¶m) == EPERM)
|
||||
return FAIL;
|
||||
FILE_LOG(logINFO) << "Listener Thread Priority set to " << priority;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user