From: Subrata M. <su...@li...> - 2008-02-20 10:21:26
|
The Final one also Merged. Thanks-- Subrata On Thu, 2008-02-14 at 13:37 +0100, Sebastien Dugue wrote: > The 'period missed' check of the thread first loop should not depend on the > thread starting time. This is especially visible on 'slow' platforms where > one cannot run the test if thread creation takes a long time. > > Fix it by removing this dependency. All delays are now calculated relative > to when the thread starts. > > Signed-off-by: Sebastien Dugue <seb...@bu...> > Cc: Darren Hart <dv...@us...> > Cc: Tim Chavez <ti...@us...> > Cc: Matthieu CASTET <mat...@pa...> > --- > .../realtime/func/sched_latency/sched_latency.c | 13 ++++++------- > 1 files changed, 6 insertions(+), 7 deletions(-) > > diff --git a/testcases/realtime/func/sched_latency/sched_latency.c b/testcases/realtime/func/sched_latency/sched_latency.c > index b7ba74b..8500525 100644 > --- a/testcases/realtime/func/sched_latency/sched_latency.c > +++ b/testcases/realtime/func/sched_latency/sched_latency.c > @@ -121,12 +121,11 @@ void *periodic_thread(void *arg) > int i; > nsec_t delay, avg_delay = 0, start_delay, min_delay = -1ULL, max_delay = 0; > int failures = 0; > - nsec_t next = 0, now = 0, sched_delta = 0, delta = 0, prev = 0; > + nsec_t next = 0, now = 0, sched_delta = 0, delta = 0, prev = 0, iter_start; > > - prev = start; > - next = start; > now = rt_gettime(); > start_delay = (now - start)/NS_PER_US; > + iter_start = next = now; > > debug(DBG_INFO, "ITERATION DELAY(US) MAX_DELAY(US) FAILURES\n"); > debug(DBG_INFO, "--------- --------- ------------- --------\n"); > @@ -147,9 +146,9 @@ void *periodic_thread(void *arg) > printf(" actual delta: %8llu us\n", delta/1000); > printf(" latency: %8llu us\n", (delta-sched_delta)/1000); > printf("---------------------------------------\n"); > - printf(" previous start: %8llu us\n", (prev-start)/1000); > - printf(" now: %8llu us\n", (now-start)/1000); > - printf(" scheduled start: %8llu us\n", (next-start)/1000); > + printf(" previous start: %8llu us\n", (prev-iter_start)/1000); > + printf(" now: %8llu us\n", (now-iter_start)/1000); > + printf(" scheduled start: %8llu us\n", (next-iter_start)/1000); > printf("next scheduled start is in the past!\n"); > ret = 1; > break; > @@ -167,7 +166,7 @@ void *periodic_thread(void *arg) > } while (now < next); > > /* start of period */ > - delay = (now - start - (nsec_t)(i+1)*period)/NS_PER_US; > + delay = (now - iter_start - (nsec_t)(i+1)*period)/NS_PER_US; > dat.records[i].x = i; > dat.records[i].y = delay; > if (delay < min_delay) |