comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject: Re: how to analyze clock drift
Date: Thu, 20 Nov 2014 09:11:49 -0500
Date: 2014-11-20T09:11:49-05:00	[thread overview]
Message-ID: <4hsr6a1p4620nlmoki7ccq24npf4hbecs4@4ax.com> (raw)
In-Reply-To: 87sihed6ci.fsf@debian.uxu

On Thu, 20 Nov 2014 02:10:53 +0100, Emanuel Berg <embe8573@student.uu.se>
declaimed the following:

>I have written a program [1] to get the data items
>that have been mentioned in different posts in this
>thread and in mails.
>
	Well -- it's not Ada...

>Does it make sense? If so, what do those digits tell
>you?
>

	Nothing without knowledge of the collection method.

	If you aren't using a separate, regulated, clock signal to trigger the
data collection you won't be able to determine clock drift.

	That is, something in the form of (pseudo-code) ...

	t0 = time.now() + msec * 2
	t1 = msec
	loop
		delay until t0 + t1
		ticks = clock()
		write(ticks)
		t1 = t1 + msec
	end loop

... is using the same clock for timing as you are trying to analyze...
Doesn't matter how much it drifts -- it is counting based upon some ticks
per second value. The only thing the collected numbers can give you is the
overhead, in clock ticks, from when the delay until "wakes up" to when the
clock() reads the actual clock. That delay can include OS overhead, process
scheduling (just because the delay expired doesn't mean this task
immediately gets CPU time -- there may be other higher priority tasks that
run before it; delay until only promises not to wake up BEFORE the
specified time).

	To determine clock /drift/ you need an external stable signal at some
known frequency, and either a CPU intensive busy-wait (and kick up your
priority so the OS doesn't get in the way <G>); or a relatively high
priority interrupt attached...

	loop
		// wait for external clock to go high
		while xclk.pin() = LOW loop null end loop
		// capture system clock
		ticks = clock()
		write(ticks)
		// wait for external clock to go back low
		while xclk.pin() = HIGH loop null end loop
	end loop
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/


  reply	other threads:[~2014-11-20 14:11 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 22:12 how to analyze clock drift Emanuel Berg
2014-11-19  1:41 ` tmoran
2014-11-19  2:10   ` Emanuel Berg
2014-11-19 10:30     ` Jacob Sparre Andersen
2014-11-19 22:15       ` Emanuel Berg
2014-11-20 16:27         ` Stephen Leake
2014-11-20  1:10       ` Emanuel Berg
2014-11-20 14:11         ` Dennis Lee Bieber [this message]
2014-11-19 13:08   ` Brian Drummond
2014-11-19  2:10 ` Simon Clubley
2014-11-19  2:37   ` Emanuel Berg
2014-11-19  2:28 ` Dennis Lee Bieber
2014-11-19  2:44   ` tmoran
2014-11-19  2:51     ` Emanuel Berg
2014-11-19  9:01       ` Dmitry A. Kazakov
2014-11-19 22:12         ` Emanuel Berg
2014-11-20  9:42           ` Dmitry A. Kazakov
2014-11-20 20:41             ` Emanuel Berg
2014-11-20 21:27               ` Dmitry A. Kazakov
2014-11-20 21:54                 ` Emanuel Berg
2014-11-20 21:57                   ` Emanuel Berg
2014-11-21  2:27                   ` Dennis Lee Bieber
2014-11-21  3:02                     ` Emanuel Berg
2014-11-21 16:49                       ` Dennis Lee Bieber
2014-11-21 21:06                         ` Emanuel Berg
2014-11-22 18:18                           ` Dennis Lee Bieber
2014-11-23 20:15                             ` Emanuel Berg
2014-11-24  1:15                               ` Dennis Lee Bieber
2014-11-24  1:34                                 ` Emanuel Berg
2014-11-24  9:22                                   ` Jacob Sparre Andersen
2014-11-24 17:30                                   ` Dennis Lee Bieber
2014-11-24  8:44                                 ` Dmitry A. Kazakov
2014-11-24 17:24                                   ` Dennis Lee Bieber
2014-11-24 18:28                                     ` Dmitry A. Kazakov
2014-11-24 20:30                                       ` brbarkstrom
2014-11-24 21:03                                         ` Dmitry A. Kazakov
2014-11-24 21:34                                           ` brbarkstrom
2014-11-25 14:04                                           ` brbarkstrom
2014-11-25 18:16                                             ` Dennis Lee Bieber
2014-11-25 20:50                                               ` brbarkstrom
2014-11-21 21:15                         ` Emanuel Berg
2014-11-21 22:31                           ` Emanuel Berg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox