Re: [chrony-users] Chrony's offset calculation mechanism

[ Thread Index | Date Index | More Archives ]

On Wed, Mar 02, 2016 at 06:16:12PM +0100, Thomas Koehler wrote:
> while experimenting with capturing a timing gps receiver's PPS-Output
> highly accurate (~ 30ns pps jitter + ~30ns capturing jitter), I
> configured chrony and NTPD hooked up to my linux pps source.
> Chrony gave me way better results with +- 100ns offset 50% of the time
> and +- 300ns offset 99% of the time.
> NTPD values are each about 5 times higher.

Which offsets exactly are you comparing?

There are quite a few different values reported by chronyc and the
only one that I think can be compared directly to the offset values
from ntpq -p is the original sample offset printed in square brackets
in the chronyc sources report. Even that is not exactly the same as
chronyd and ntpd use slightly different median filters for refclock

> I tried to verify this values by putting out the PPS timestamps directly
> in my PPS kernel module.
> There I see values of up to +- 1500ns, no matter if I use chrony or NTPD.
> Interestingly the offset values NTPD reports are exactly the numbers I
> see in the Kernel module.

That's interesting. Both ntpd and chronyd use a median filter for
refclocks samples, so the reported offsets should normally be smaller
than raw refclock offsets. Basically there are three layers when using
a PPS refclock:

- raw PPS samples, these are the values from the kernel. chronyd
  reports them in the refclocks log (lines that have a number in the
  DP column) and the ATOM driver in ntpd reports them in the
  clockstats log if flag4 is set.
- samples from the median filter, these are in the chrony refclocks
  log (lines that have - in the DP column), chronyc sources, and
  ntpq -p or ntpq -c 'rv &associd'
- chronyd's tracking layer using linear regression and ntpd's clock
  filter with the kernel PLL, these are very different

If you want to compare the performance of chronyd and ntpd, it's best
to capture the raw PPS samples from the kernel and process that data
using the same method, e.g. a median filter with window of 16 samples.

> I tried to dive into the code and look up the offset calculation. It
> seems a bit complicated to me.
> Is there any source of documentation for chrony where an in depth look
> is given on topics like tracking offset calculations?

No, unfortunately not. Just the code.

Miroslav Lichvar

To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.

Mail converted by MHonArc 2.6.19+