Log the processor info like scheduler policy
And CPU affinity. Also, use mlockall to keep our memory from being swapped out.
This commit is contained in:
@@ -444,4 +444,42 @@ task_list_t tasks[TASK_MAX];
|
||||
// Stupid function, kept for compatibility (the parameter is meaningless!!!)
|
||||
}
|
||||
int signal_mask(void) { return 0;}
|
||||
|
||||
void log_scheduler(const char* label)
|
||||
{
|
||||
int policy = sched_getscheduler(0);
|
||||
struct sched_param param;
|
||||
if (sched_getparam(0, ¶m) == -1)
|
||||
{
|
||||
LOG_E(HW, "sched_getparam: %s\n", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
|
||||
cpu_set_t cpu_set;
|
||||
if (sched_getaffinity(0, sizeof(cpu_set), &cpu_set) == -1)
|
||||
{
|
||||
LOG_E(HW, "sched_getaffinity: %s\n", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
int num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
if (num_cpus < 1)
|
||||
{
|
||||
LOG_E(HW, "sysconf(_SC_NPROCESSORS_ONLN): %s\n", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
char buffer[num_cpus];
|
||||
for (int i = 0; i < num_cpus; i++)
|
||||
{
|
||||
buffer[i] = CPU_ISSET(i, &cpu_set) ? 'Y' : '-';
|
||||
}
|
||||
|
||||
LOG_A(HW, "Scheduler policy=%d priority=%d affinity=[%d]%.*s label=%s\n",
|
||||
policy,
|
||||
param.sched_priority,
|
||||
num_cpus,
|
||||
num_cpus,
|
||||
buffer,
|
||||
label);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -567,6 +567,8 @@ int timer_remove(long timer_id);
|
||||
int signal_handle(int *end);
|
||||
int signal_mask(void);
|
||||
|
||||
void log_scheduler(const char *label);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -520,7 +520,12 @@ int main ( int argc, char **argv )
|
||||
};
|
||||
if (sched_setscheduler( 0, SCHED_RR, ¶m ) == -1 )
|
||||
{
|
||||
fprintf(stderr,"error setting scheduler ... are you root?\n");
|
||||
fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
|
||||
{
|
||||
fprintf(stderr, "mlockall: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -726,6 +731,7 @@ int main ( int argc, char **argv )
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||
}
|
||||
log_scheduler("eNB-main");
|
||||
create_tasks_mbms(1);
|
||||
|
||||
// wait for end of program
|
||||
|
||||
@@ -2031,6 +2031,8 @@ void *UE_thread(void *arg)
|
||||
oai_exit=1;
|
||||
}
|
||||
|
||||
log_scheduler(__func__);
|
||||
|
||||
while (!oai_exit) {
|
||||
if (IS_SOFTMODEM_BASICSIM)
|
||||
while (!(UE->proc.instance_cnt_synch < 0)) {
|
||||
|
||||
@@ -548,7 +548,12 @@ int main( int argc, char **argv ) {
|
||||
};
|
||||
if (sched_setscheduler( 0, SCHED_RR, ¶m ) == -1 )
|
||||
{
|
||||
fprintf(stderr,"error setting scheduler ... are you root?\n");
|
||||
fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
|
||||
{
|
||||
fprintf(stderr, "mlockall: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user