On Thursday 10 January 2008 03:12:23 Sebastien Dugue wrote:
>   Make the iteration loop zero-based, otherwise we write past the
> samples array boundary and waste the first cell.
>
> Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>

Acked-by: Darren Hart <[EMAIL PROTECTED]>

> Cc: Darren Hart <[EMAIL PROTECTED]>
> Cc: Tim Chavez <[EMAIL PROTECTED]>
> ---
>  .../realtime/func/sched_latency/sched_latency.c    |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/realtime/func/sched_latency/sched_latency.c
> b/testcases/realtime/func/sched_latency/sched_latency.c index
> 9c6514f..a121545 100644
> --- a/testcases/realtime/func/sched_latency/sched_latency.c
> +++ b/testcases/realtime/func/sched_latency/sched_latency.c
> @@ -136,7 +136,7 @@ void *periodic_thread(void *arg)
>               latency_trace_enable();
>               latency_trace_start();
>       }
> -     for (i = 1; i <= iterations; i++) {
> +     for (i = 0; i < iterations; i++) {
>               /* wait for the period to start */
>               next += period;
>               prev = now;
> @@ -166,7 +166,7 @@ void *periodic_thread(void *arg)
>
>               /* start of period */
>               now = rt_gettime();
> -             delay = (now - start - (nsec_t)i*period)/NS_PER_US;
> +             delay = (now - start - (nsec_t)(i+1)*period)/NS_PER_US;
>               dat.records[i].x = i;
>               dat.records[i].y = delay;
>               if (delay < min_delay)
> @@ -189,11 +189,11 @@ void *periodic_thread(void *arg)
>       }
>       if (latency_threshold) {
>               latency_trace_stop();
> -             if (i != (iterations + 1)) {
> +             if (i != iterations) {
>                       printf("Latency threshold (%lluus) exceeded at 
> iteration %d\n",
>                               latency_threshold, i);
>                       latency_trace_print();
> -                     stats_container_resize(&dat, i);
> +                     stats_container_resize(&dat, i+1);
>               }
>       }
>
> @@ -204,7 +204,7 @@ void *periodic_thread(void *arg)
>       stats_container_save("hist", "Periodic Scheduling Latency
> Histogram",\ "Iteration", "Latency (us)", &hist, "steps");
>
> -     avg_delay /= (i - 1);
> +     avg_delay /= (i + 1);
>       printf("\n\n");
>       printf("Start: %4llu us: %s\n", start_delay,
>               start_delay < PASS_US ? "PASS" : "FAIL");



-- 
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to