Message ID | 1412281662-37873-1-git-send-email-mike.holmes@linaro.org |
---|---|
State | Superseded |
Headers | show |
Merged! Maxim. On 10/03/2014 12:27 AM, Mike Holmes wrote: > tot is = i which cannot leave the for loop without being positive > unless it exits entirely and never reaches the test statement. > Or QUEUE_ROUNDS is #defined to 0 rather than (512*1024) > Thus tot is always true and the else cannot execute > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > example/odp_example/odp_example.c | 27 ++++++--------------------- > 1 file changed, 6 insertions(+), 21 deletions(-) > > diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c > index c80dbbc..dd572eb 100644 > --- a/example/odp_example/odp_example.c > +++ b/example/odp_example/odp_example.c > @@ -415,13 +415,8 @@ static int test_schedule_one_many(const char *str, int thr, > odp_barrier_sync(&test_barrier); > clear_sched_queues(); > > - if (tot) { > - cycles = cycles/tot; > - ns = ns/tot; > - } else { > - cycles = 0; > - ns = 0; > - } > + cycles = cycles/tot; > + ns = ns/tot; > > printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", > thr, str, cycles, ns); > @@ -493,13 +488,8 @@ static int test_schedule_single(const char *str, int thr, > odp_barrier_sync(&test_barrier); > clear_sched_queues(); > > - if (tot) { > - cycles = cycles/tot; > - ns = ns/tot; > - } else { > - cycles = 0; > - ns = 0; > - } > + cycles = cycles/tot; > + ns = ns/tot; > > printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", > thr, str, cycles, ns); > @@ -575,13 +565,8 @@ static int test_schedule_many(const char *str, int thr, > odp_barrier_sync(&test_barrier); > clear_sched_queues(); > > - if (tot) { > - cycles = cycles/tot; > - ns = ns/tot; > - } else { > - cycles = 0; > - ns = 0; > - } > + cycles = cycles/tot; > + ns = ns/tot; > > printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", > thr, str, cycles, ns);
diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c index c80dbbc..dd572eb 100644 --- a/example/odp_example/odp_example.c +++ b/example/odp_example/odp_example.c @@ -415,13 +415,8 @@ static int test_schedule_one_many(const char *str, int thr, odp_barrier_sync(&test_barrier); clear_sched_queues(); - if (tot) { - cycles = cycles/tot; - ns = ns/tot; - } else { - cycles = 0; - ns = 0; - } + cycles = cycles/tot; + ns = ns/tot; printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", thr, str, cycles, ns); @@ -493,13 +488,8 @@ static int test_schedule_single(const char *str, int thr, odp_barrier_sync(&test_barrier); clear_sched_queues(); - if (tot) { - cycles = cycles/tot; - ns = ns/tot; - } else { - cycles = 0; - ns = 0; - } + cycles = cycles/tot; + ns = ns/tot; printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", thr, str, cycles, ns); @@ -575,13 +565,8 @@ static int test_schedule_many(const char *str, int thr, odp_barrier_sync(&test_barrier); clear_sched_queues(); - if (tot) { - cycles = cycles/tot; - ns = ns/tot; - } else { - cycles = 0; - ns = 0; - } + cycles = cycles/tot; + ns = ns/tot; printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", thr, str, cycles, ns);
tot is = i which cannot leave the for loop without being positive unless it exits entirely and never reaches the test statement. Or QUEUE_ROUNDS is #defined to 0 rather than (512*1024) Thus tot is always true and the else cannot execute Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- example/odp_example/odp_example.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-)