From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: Xl.tags.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 20 Nov 2014 08:11:46 -0600 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: how to analyze clock drift Date: Thu, 20 Nov 2014 09:11:49 -0500 Organization: IISS Elusive Unicorn Message-ID: <4hsr6a1p4620nlmoki7ccq24npf4hbecs4@4ax.com> References: <87bno4gnuz.fsf@debian.uxu> <87k32s3ppt.fsf@debian.uxu> <87sihf32kr.fsf@adaheads.sparre-andersen.dk> <87sihed6ci.fsf@debian.uxu> X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 108.79.216.34 X-Trace: sv3-J09DqKn9QqSxEyYmaYIGBpSHHi3Jsn2jjwXH1VtMZj5IsoMRSXAuY6tbHjVYBX0CvhYUzTd3V9tjcM0!uA9tNPr8s3EmXSTQn4K6tskXO7NwjcnqwXNawV3fCwNRUYhRDmy+qolKETLagDZCelAgKjTITjHk!FwT/W7tQhplRu7dU18inPsepKVg= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3152 Xref: number.nntp.giganews.com comp.lang.ada:190875 Date: 2014-11-20T09:11:49-05:00 List-Id: On Thu, 20 Nov 2014 02:10:53 +0100, Emanuel Berg 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 ); 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/