comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: how to analyze clock drift
Date: Wed, 19 Nov 2014 10:01:10 +0100
Date: 2014-11-19T10:01:10+01:00	[thread overview]
Message-ID: <1nvfhit2csxr5.41v36jksch28$.dlg@40tude.net> (raw)
In-Reply-To: 87zjbn3nss.fsf@debian.uxu

On Wed, 19 Nov 2014 03:51:47 +0100, Emanuel Berg wrote:

> tmoran@acm.org writes:
> 
>> To quote Richard Hamming "The purpose of computing
>> is insight, not numbers". What is it that you want
>> to know here? How do you hope to make use of what
>> you learn?
> 
> It is a Master project in CS.
> 
> My teacher said those C++ timers aren't rock-solid.

You certainly can use OS services from C++, instead of them.

> Can I use them anyway? I asked.
> 
> Yes, but output the tick times, and analyze just how
> "not rock-solid" they are, he said. (Pseudo quotes.)

You need a reference clock to measure drift and jitter. If you use sleep,
there is a trend you cannot estimate (that is why Ada has delay and delay
until). So you would not know which part of the drift is due to the clock
deviation (that is typically somewhere around 5 µs/s) and which part is due
to the sleep's systematic error.

> That's what I'm trying to do.

Basically you need to identify the model

   Tc = Tr + a * Tr + e

Tc is C++ clock. Tr is the reference clock. Both start at 0 (the epoch). a
is the constant deviation. e is a random error (jitter). Both a and e are
contaminated by the systematic sleep error.

This is a simple linear regression, which you can find in almost any
statistical package or application. You also can implement it yourself.

The regression will give you the value of a and the mean of e. Having a you
can estimate the dispersion of e. It is to expect that e is not really
normally distributed, so you could try to verify other hypotheses of
distributions (statistical packages have tools for that). However I would
consider it wasting time.

Regarding being rock-solid, it probably the jitter was meant. In your case
jitter also includes errors induced by OS services, e.g. by scheduling of
the process and the task, by timer interrupt frequency when the clock is
driven from there etc. All this contributes to the mean and the dispersion
of e.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2014-11-19  9:01 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
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 [this message]
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