Merge branch 'episys/mcook-log-scheduler' into 'episys/master'
Log the processor info like scheduler policy See merge request aburger/openairinterface5g!14
This commit is contained in:
@@ -444,4 +444,42 @@ task_list_t tasks[TASK_MAX];
|
|||||||
// Stupid function, kept for compatibility (the parameter is meaningless!!!)
|
// Stupid function, kept for compatibility (the parameter is meaningless!!!)
|
||||||
}
|
}
|
||||||
int signal_mask(void) { return 0;}
|
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_handle(int *end);
|
||||||
int signal_mask(void);
|
int signal_mask(void);
|
||||||
|
|
||||||
|
void log_scheduler(const char *label);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -520,7 +520,12 @@ int main ( int argc, char **argv )
|
|||||||
};
|
};
|
||||||
if (sched_setscheduler( 0, SCHED_RR, ¶m ) == -1 )
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,6 +731,7 @@ int main ( int argc, char **argv )
|
|||||||
pthread_mutex_unlock(&sync_mutex);
|
pthread_mutex_unlock(&sync_mutex);
|
||||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||||
}
|
}
|
||||||
|
log_scheduler("eNB-main");
|
||||||
create_tasks_mbms(1);
|
create_tasks_mbms(1);
|
||||||
|
|
||||||
// wait for end of program
|
// wait for end of program
|
||||||
|
|||||||
@@ -2031,6 +2031,8 @@ void *UE_thread(void *arg)
|
|||||||
oai_exit=1;
|
oai_exit=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_scheduler(__func__);
|
||||||
|
|
||||||
while (!oai_exit) {
|
while (!oai_exit) {
|
||||||
if (IS_SOFTMODEM_BASICSIM)
|
if (IS_SOFTMODEM_BASICSIM)
|
||||||
while (!(UE->proc.instance_cnt_synch < 0)) {
|
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 )
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user