[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom [=?iso-8859-1?Q?S=E9bastien?= GAUME<sgaume@b2i-toulous (fwd)



>From owner-rtl Mon May 21 01:39:43 2001
Received: from mail.b2i-toulouse.com (host.97.67.23.62.rev.coltfrance.com [62.23.67.97])
	by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f4L7dgr17718
	for <rtl@fsmlabs.com>; Mon, 21 May 2001 01:39:42 -0600
Received: from b2i-toulouse.com (wilson.b2i-toulouse.com [192.168.0.25] (may be forged))
	by mail.b2i-toulouse.com (8.11.0/8.11.0) with ESMTP id f4L6UPd09141
	for <rtl@fsmlabs.com>; Mon, 21 May 2001 08:30:25 +0200
Message-ID: <3B08C5AC.4E852AD@b2i-toulouse.com>
Date: Mon, 21 May 2001 09:37:16 +0200
From: =?iso-8859-1?Q?S=E9bastien?= GAUME <sgaume@b2i-toulouse.com>
Organization: b2i-toulouse
X-Mailer: Mozilla 4.75 [fr] (WinNT; U)
X-Accept-Language: fr
MIME-Version: 1.0
To: rtl@fsmlabs.com
Subject: Re: [rtl] gethrtime
References: <Pine.LNX.4.31.0105192040310.610-100000@Myrtille.localdomain>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Thank you for this clue.

Sebastien

Klaas Gadeyne a ecrit :

> > oneshot mode. Periodically, the next wake up date is calculated in clock
> > units. Because the period in clock unit is not equal to the period in
> > nanoseconds, a drift should be seen, especially after a large number of
> > periods.
> >
> > In fact, after having done this test, I did not see such a drift. Do not
> > think I am disapointed, I'm not ! I would like to know wether I am wrong
> > in my assumptions or not, and if not, how the gethrtime function manages
> > not to create a drift.
>
> I don't know wether you're wrong in your assumptions but a couple of weeks
> ago I was working on some steppermotor software and there there was
> obviously some drift when just using a call (for constant speed)
>
> while(1)
> {
>         pthread_make_periodic_np(pthread_self(),gethrtime()+period,0);
>         pthread_wait_np();
>         outb(...);
> }
>
> I don't know wether the drift is due to the rounding process, but the
> jitter alone is responsible for drift.
>
> To avoid drifting errors you can use "absolute timing", ie something like
>
> next_fire_time = somewhere in the future;
> while(1)
> {
>         pthread_make_periodic_np(pthread_self(),next_fire_time,0);
>         pthread_wait_np();
>         outb(...);
>         next_fire_time += period;
> }
>
> Hope this was somewhat an answer to your question,
>
> regards
>
> klaas
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/