On Tue, Mar 03, 2015 at 11:44:47AM -0800, Gary E. Miller wrote:
> Miroslav Lichvar <mlich...@redhat.com> wrote:
> > On Tue, Mar 03, 2015 at 12:38:41AM -0800, Gary E. Miller wrote:
> > > First, why does chronyd not support uSec SHM?  (I usually use the
> > > SOCK)
> > 
> > It does support both microsecond and nanosecond resolution in SHM.
> 
> Very odd.  That is not what I have been seeing, so instead of unimplemented
> it must be broken.

What exactly do you see?

When I run

# chronyd 'refclock SHM 10 poll 2' 'logdir logs' 'log refclocks'
# phc2sys -E ntpshm -M 10 -m -ar

I see in refclocks.log

2015-03-04 08:12:39.659890 SHM1    0 N 0 -9.000000e-09  1.296176e-08  1.000e-06
2015-03-04 08:12:40.660008 SHM1    1 N 0  1.200000e-08  1.197851e-08  1.000e-06
2015-03-04 08:12:41.660120 SHM1    2 N 0 -1.400000e-08 -1.402629e-08  1.000e-06
2015-03-04 08:12:42.660227 SHM1    3 N 0  2.500000e-08  2.496892e-08  1.000e-06

The raw offset values are nicely rounded to nanoseconds.

If I modify ntpshm.c in linuxptp to disable nanosecond resolution (set
the nanosecond fields to 0), I see in refclocks.log

2015-03-04 08:17:11.702451 SHM1    0 N 0  0.000000e+00 -4.236286e-08  1.000e-06
2015-03-04 08:17:12.702575 SHM1    1 N 0  1.000000e-06  9.634952e-07  1.000e-06
2015-03-04 08:17:13.702691 SHM1    2 N 0  0.000000e+00 -3.064677e-08  1.000e-06
2015-03-04 08:17:14.702817 SHM1    3 N 0  0.000000e+00 -2.478869e-08  1.000e-06
2015-03-04 08:17:14.202754 SHM1    - N -       -       -2.771773e-08  1.000e-06

Three raw offsets are 0 and one is exactly 1 microsecond, so it looks
to be working as expected.

> > No, I was just trying to explain that the refclock precision prevents
> > that problem. If several consecutive refclock samples have identical
> > offset, the calculated dispersion might be zero, but it will be set
> > to the precision before accumulating the sample to avoid division by
> > zero etc.
> 
> So if the offset is zero it is set to the dispersion?  That is not good.

No, the offset will be still zero, but dispersion will be set to precision.
Here is an example.

2015-03-04 08:20:39.727811 SHM1    0 N 0  0.000000e+00  5.347800e-09  1.000e-06
2015-03-04 08:20:40.727928 SHM1    1 N 0  0.000000e+00  5.267678e-09  1.000e-06
2015-03-04 08:20:41.728044 SHM1    2 N 0  0.000000e+00  5.187555e-09  1.000e-06
2015-03-04 08:20:42.728155 SHM1    3 N 0  0.000000e+00  5.107433e-09  1.000e-06
2015-03-04 08:20:41.227986 SHM1    - N -       -        5.227617e-09  1.000e-06

The filtered sample has 1 microsecond dispersion, even when all four
SHM samples were 0.

-- 
Miroslav Lichvar

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to