diff options
author | Petri Savolainen <petri.savolainen@linaro.org> | 2014-09-04 12:55:11 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2014-09-04 19:38:25 +0400 |
commit | daa0756b0a4474a483cd366e74c1fa4c737655ba (patch) | |
tree | e718ed23bb3c072d9c3706693f54618647440b67 /example/timer/odp_timer_test.c | |
parent | 073a83d58f8670188ae7d7586c2194dd4b173fdb (diff) |
Timer example error check
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-and-Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'example/timer/odp_timer_test.c')
-rw-r--r-- | example/timer/odp_timer_test.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 4168856ec..106119030 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -26,10 +26,6 @@ #define MAX_WORKERS 32 /**< Max worker threads */ #define MSG_POOL_SIZE (4*1024*1024) /**< Message pool size */ -/* Nanoseconds */ -#define USEC 1000UL -#define MSEC 1000000UL -#define SEC 1000000000UL /** Test arguments */ typedef struct { @@ -63,7 +59,7 @@ static void test_abs_timeouts(int thr, test_args_t *args) queue = odp_queue_lookup("timer_queue"); - period_ns = args->period_us*USEC; + period_ns = args->period_us*ODP_TIME_USEC; period = odp_timer_ns_to_tick(test_timer, period_ns); ODP_DBG(" [%i] period %"PRIu64" ticks, %"PRIu64" ns\n", thr, @@ -195,7 +191,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) args->core_count = 0; /* all cores */ args->resolution_us = 10000; args->min_us = args->resolution_us; - args->max_us = 100000000; + args->max_us = 10000000; args->period_us = 1000000; args->tmo_count = 30; @@ -343,9 +339,15 @@ int main(int argc, char *argv[]) } test_timer = odp_timer_create("test_timer", pool, - args.resolution_us*USEC, - args.min_us*USEC, - args.max_us*USEC); + args.resolution_us*ODP_TIME_USEC, + args.min_us*ODP_TIME_USEC, + args.max_us*ODP_TIME_USEC); + + if (test_timer == ODP_TIMER_INVALID) { + ODP_ERR("Timer create failed.\n"); + return -1; + } + odp_shm_print_all(); @@ -358,7 +360,7 @@ int main(int argc, char *argv[]) printf(" %12"PRIu64" cycles -> %12"PRIu64" ns\n", cycles, odp_time_cycles_to_ns(cycles)); - for (ns = 1; ns <= 100*SEC; ns *= 10) { + for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) { cycles = odp_time_ns_to_cycles(ns); printf(" %12"PRIu64" ns -> %12"PRIu64" cycles\n", ns, |