On Thursday 10 January 2008 03:12:24 Sebastien Dugue wrote:
> rt_gettime() may come cheap, but no need to overdo it. This patch
> removes 2 unecessary calls to rt_gettime() in the iteration loop.
>
> 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 | 8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/realtime/func/sched_latency/sched_latency.c
> b/testcases/realtime/func/sched_latency/sched_latency.c index
> a121545..55caef3 100644
> --- a/testcases/realtime/func/sched_latency/sched_latency.c
> +++ b/testcases/realtime/func/sched_latency/sched_latency.c
> @@ -159,13 +159,15 @@ void *periodic_thread(void *arg)
> sched_delta = next - now; /* how long we should sleep */
> delta = 0;
> do {
> + nsec_t new_now;
> +
> rt_nanosleep(next - now);
> - delta += rt_gettime() - now; /* how long we did sleep */
> - now = rt_gettime();
> + new_now = rt_gettime();
> + delta += new_now - now; /* how long we did sleep */
> + now = new_now;
> } while (now < next);
>
> /* start of period */
> - now = rt_gettime();
> delay = (now - start - (nsec_t)(i+1)*period)/NS_PER_US;
> dat.records[i].x = i;
> dat.records[i].y = delay;
--
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