aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2018-11-13 15:08:02 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-11-16 21:58:06 +0300
commit12c4ca508b07b8d2366b0c37bee5f866019e94c2 (patch)
tree7c5d0a32a43d0ebd81565bbdd7dd870f971a7796
parent9ddeaaf7a3226ab03e57cc49775fd234b8d44a2b (diff)
linux-gen: timer: add config option for inline timer poll frequency
Add configure option 'timer.inline_poll_interval' for adjusting inline timer polling frequency. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--config/odp-linux-generic.conf7
-rw-r--r--platform/linux-generic/include/odp_timer_internal.h3
-rw-r--r--platform/linux-generic/odp_timer.c16
3 files changed, 19 insertions, 7 deletions
diff --git a/config/odp-linux-generic.conf b/config/odp-linux-generic.conf
index d123e7735..9969860d5 100644
--- a/config/odp-linux-generic.conf
+++ b/config/odp-linux-generic.conf
@@ -140,4 +140,11 @@ timer: {
#
# Set to 1 to enable
inline = 0
+
+ # Inline timer poll interval
+ #
+ # When set to 1 inline timers are polled during every schedule round.
+ # Increasing the value reduces timer processing overhead while
+ # decreasing accuracy. Ignored when inline timer is not enabled.
+ inline_poll_interval = 10
}
diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h
index 02ba92e0d..1f612448e 100644
--- a/platform/linux-generic/include/odp_timer_internal.h
+++ b/platform/linux-generic/include/odp_timer_internal.h
@@ -21,9 +21,6 @@
#include <odp/api/timer.h>
#include <odp_global_data.h>
-/* Minimum number of scheduling rounds between checking timer pools. */
-#define CONFIG_TIMER_RUN_RATELIMIT_ROUNDS 1
-
/**
* Internal Timeout header
*/
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index fcda6e396..6307ae4f0 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -219,6 +219,7 @@ typedef struct timer_global_t {
_odp_atomic_flag_t ODP_ALIGNED_CACHE locks[NUM_LOCKS];
#endif
odp_bool_t use_inline_timers;
+ int inline_poll_interval;
} timer_global_t;
static timer_global_t *timer_global;
@@ -871,8 +872,7 @@ static unsigned process_timer_pools(void)
unsigned _timer_run(void)
{
static __thread odp_time_t last_timer_run;
- static __thread unsigned timer_run_cnt =
- CONFIG_TIMER_RUN_RATELIMIT_ROUNDS;
+ static __thread unsigned timer_run_cnt = 1;
odp_time_t now;
if (timer_global->num_timer_pools == 0)
@@ -880,10 +880,10 @@ unsigned _timer_run(void)
/* Rate limit how often this thread checks the timer pools. */
- if (CONFIG_TIMER_RUN_RATELIMIT_ROUNDS > 1) {
+ if (timer_global->inline_poll_interval > 1) {
if (--timer_run_cnt)
return 0;
- timer_run_cnt = CONFIG_TIMER_RUN_RATELIMIT_ROUNDS;
+ timer_run_cnt = timer_global->inline_poll_interval;
}
now = odp_time_global();
@@ -1354,6 +1354,14 @@ int odp_timer_init_global(const odp_init_t *params)
}
timer_global->use_inline_timers = val;
+ conf_str = "timer.inline_poll_interval";
+ if (!_odp_libconfig_lookup_int(conf_str, &val)) {
+ ODP_ERR("Config option '%s' not found.\n", conf_str);
+ odp_shm_free(shm);
+ return -1;
+ }
+ timer_global->inline_poll_interval = val;
+
if (params && params->not_used.feat.timer)
timer_global->use_inline_timers = false;