Changed priorities to below UHD in srsUE

This commit is contained in:
Ismael Gomez 2018-01-25 15:02:11 +01:00
parent c0bbf6c5ae
commit 754566b28f
5 changed files with 25 additions and 4 deletions

View File

@ -38,7 +38,8 @@ public:
bool init(metrics_interface<metrics_t> *m_, float report_period_secs_=1.0) {
m = m_;
report_period_secs = report_period_secs_;
start_periodic(report_period_secs*1e6);
// Start with user-default priority
start_periodic(report_period_secs*1e6, -2);
return true;
}
void stop() {

View File

@ -30,6 +30,9 @@
#include <unistd.h>
#include <stdio.h>
// Default priority for all threads below UHD threads
#define DEFAULT_PRIORITY 60
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

View File

@ -67,6 +67,20 @@ bool threads_new_rt_cpu(pthread_t *thread, void *(*start_routine) (void*), void
fprintf(stderr, "Error not enough privileges to set Scheduling priority\n");
}
attr_enable = true;
} else if (prio_offset == -1) {
param.sched_priority = sched_get_priority_max(SCHED_FIFO) - DEFAULT_PRIORITY;
pthread_attr_init(&attr);
if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)) {
perror("pthread_attr_setinheritsched");
}
if (pthread_attr_setschedpolicy(&attr, SCHED_FIFO)) {
perror("pthread_attr_setschedpolicy");
}
if (pthread_attr_setschedparam(&attr, &param)) {
perror("pthread_attr_setschedparam");
fprintf(stderr, "Error not enough privileges to set Scheduling priority\n");
}
attr_enable = true;
} else if (prio_offset == -2) {
param.sched_priority = 0;
pthread_attr_init(&attr);

View File

@ -562,7 +562,10 @@ int rf_uhd_open_multi(char *args, void **h, uint32_t nof_channels)
perror("pthread_create");
return -1;
}
/* Restore priorities */
uhd_set_thread_priority(0, false);
return 0;
} else {
return SRSLTE_ERROR_INVALID_INPUTS;

View File

@ -112,8 +112,8 @@ public:
private:
void run_thread();
static const int MAC_MAIN_THREAD_PRIO = 5;
static const int MAC_PDU_THREAD_PRIO = 6;
static const int MAC_MAIN_THREAD_PRIO = -1; // Use default high-priority below UHD
static const int MAC_PDU_THREAD_PRIO = -1;
static const int MAC_NOF_HARQ_PROC = 2*HARQ_DELAY_MS;
// Interaction with PHY