33 static int read_config_file(
void)
38 bool val_bool =
false;
44 conf_str =
"dispatch.poll_ctrl_interval";
47 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
52 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d'\n",
57 em_shm->opt.dispatch.poll_ctrl_interval = val;
58 EM_PRINT(
" %s: %d\n", conf_str, val);
63 conf_str =
"dispatch.poll_ctrl_interval_ns";
66 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
71 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %" PRId64
"'\n",
76 em_shm->opt.dispatch.poll_ctrl_interval_ns = val64;
77 long double sec = (
long double)val64 / 1000000000.0;
79 EM_PRINT(
" %s: %" PRId64
"ns (%Lfs)\n", conf_str, val64, sec);
82 em_shm->opt.dispatch.poll_ctrl_interval_time = odp_time_global_from_ns(val64);
87 conf_str =
"dispatch.poll_drain_interval";
90 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
95 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %d'\n",
100 em_shm->opt.dispatch.poll_drain_interval = val;
101 EM_PRINT(
" %s: %d\n", conf_str, val);
106 conf_str =
"dispatch.poll_drain_interval_ns";
108 if (unlikely(!ret)) {
109 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
114 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %" PRId64
"'\n",
119 em_shm->opt.dispatch.poll_drain_interval_ns = val64;
120 sec = (
long double)val64 / 1000000000.0;
122 EM_PRINT(
" %s: %" PRId64
"ns (%Lfs)\n", conf_str, val64, sec);
125 em_shm->opt.dispatch.poll_drain_interval_time = odp_time_global_from_ns(val64);
131 conf_str =
"dispatch.sched_wait_ns";
133 if (unlikely(!ret)) {
134 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found.\n", conf_str);
139 EM_LOG(EM_LOG_ERR,
"Bad config value '%s = %" PRId64
"'\n",
145 em_shm->opt.dispatch.sched_wait_ns = val64;
149 em_shm->opt.dispatch.sched_wait = ODP_SCHED_NO_WAIT;
150 EM_PRINT(
" %s: no-wait (0 ns)\n", conf_str);
151 }
else if (val64 == -1) {
152 em_shm->opt.dispatch.sched_wait = ODP_SCHED_WAIT;
153 EM_PRINT(
" %s: wait indefinitely (inf. ns)\n", conf_str);
155 em_shm->opt.dispatch.sched_wait = odp_schedule_wait_time(val64);
156 sec = (
long double)val64 / 1000000000.0;
157 EM_PRINT(
" %s: wait %" PRId64
"ns (%Lfs)\n", conf_str, val64, sec);
160 em_shm->opt.dispatch.sched_wait_ns = 0;
161 em_shm->opt.dispatch.sched_wait = ODP_SCHED_NO_WAIT;
167 conf_str =
"dispatch.sched_pause";
168 ret = em_libconfig_lookup_bool(&
em_shm->
libconfig, conf_str, &val_bool);
169 if (unlikely(!ret)) {
170 EM_LOG(EM_LOG_ERR,
"Config option '%s' not found\n", conf_str);
174 em_shm->opt.dispatch.sched_pause = val_bool;
175 EM_PRINT(
" %s: %s(%d)\n", conf_str, val_bool ?
"true" :
"false",
183 if (read_config_file())
192 odp_time_t poll_period =
em_shm->opt.dispatch.poll_ctrl_interval_time;
193 odp_time_t now = odp_time_global();
209 if (odp_time_cmp(period, poll_period) != 0)