Message ID | 1414707475-26664-1-git-send-email-mike.holmes@linaro.org |
---|---|
State | Accepted |
Commit | a4f623d86c718c9f3ff14c588c667e424591d90f |
Headers | show |
ping On 30 October 2014 18:17, Mike Holmes <mike.holmes@linaro.org> 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> > --- > > Previous patch missed a case. > Fixed indent > > example/odp_example/odp_example.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/example/odp_example/odp_example.c > b/example/odp_example/odp_example.c > index 5f25f89..1ed4a0b 100644 > --- a/example/odp_example/odp_example.c > +++ b/example/odp_example/odp_example.c > @@ -355,13 +355,8 @@ static int test_schedule_one_single(const char *str, > int thr, > odp_barrier_sync(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); > -- > 2.1.0 > >
On Mon, Nov 3, 2014 at 8:23 PM, Mike Holmes <mike.holmes@linaro.org> wrote: > ping > > On 30 October 2014 18:17, Mike Holmes <mike.holmes@linaro.org> 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 Why not use QUEUE_ROUNDS instead and get rid of tot altogether ? >> >> Signed-off-by: Mike Holmes <mike.holmes@linaro.org> >> --- >> >> Previous patch missed a case. >> Fixed indent >> >> example/odp_example/odp_example.c | 9 ++------- >> 1 file changed, 2 insertions(+), 7 deletions(-) >> >> diff --git a/example/odp_example/odp_example.c >> b/example/odp_example/odp_example.c >> index 5f25f89..1ed4a0b 100644 >> --- a/example/odp_example/odp_example.c >> +++ b/example/odp_example/odp_example.c >> @@ -355,13 +355,8 @@ static int test_schedule_one_single(const char *str, >> int thr, >> odp_barrier_sync(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); >> -- >> 2.1.0 >> > > > > -- > Mike Holmes > Linaro Sr Technical Manager > LNG - ODP > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
Applied! Maxim. On 10/31/2014 01:17 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> > --- > > Previous patch missed a case. > Fixed indent > > example/odp_example/odp_example.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c > index 5f25f89..1ed4a0b 100644 > --- a/example/odp_example/odp_example.c > +++ b/example/odp_example/odp_example.c > @@ -355,13 +355,8 @@ static int test_schedule_one_single(const char *str, int thr, > odp_barrier_sync(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 5f25f89..1ed4a0b 100644 --- a/example/odp_example/odp_example.c +++ b/example/odp_example/odp_example.c @@ -355,13 +355,8 @@ static int test_schedule_one_single(const char *str, int thr, odp_barrier_sync(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> --- Previous patch missed a case. Fixed indent example/odp_example/odp_example.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)