These patches should improve the synchronization of the clock with
larger jitters, e.g. with software timestamping, wireless networks,
etc.

The idea is to give smaller weights to samples where the sync and/or
delay messages were delayed significantly in the network and possibly
include a large error. The sample offset is based directly on the
sample delay instead of the long-term filtered delay and the sample
weight is set to the ratio of the sample delay to the long-term
average. E.g. if the measured delay is normally 1 ms and the new
sample has 10ms delay, the sample weight (and the clock adjustment
that will be made) will be 10 times smaller.

This "weighting" mode is enabled only when the sync interval is equal
or longer than the delay/pdelay request interval to not reuse the
delay timestamps too many times and keep the interval between sample
times stable. In some tests I saw an improvement also with 2:1
sync/delay rate and maybe even higher, but it would probably be tricky
to implement if it should be enabled automatically, possibly requiring
some cooperation with the delay filter.

In my testing I did so far it seems to work nicely. With the linreg
servo there should be no regression. With PI there can be worse
performance observed when the constants are not configured properly,
that is when the servo is too slow to track the frequency changes and
weighted samples make it even slower. Currently, the weighting mode is
enabled only when ki <= 0.01 to include the default SW timestamping
constant and not the HW constant. It could be always enabled or I
could add an option to override it if you think it would be useful,
I'm not sure.

What do you think? Does this make sense?


Miroslav Lichvar (6):
  clock: save delay timestamps and correction.
  clock: split out calculation of sample delay.
  servo: add support for weighted samples.
  clock: set sample weight.
  linreg: use sample weight.
  pi: use sample weight.

 clock.c         | 85 ++++++++++++++++++++++++++++++++++++++++++++-------------
 clock.h         | 10 +++++--
 linreg.c        | 64 +++++++++++++++++++++++++++++--------------
 ntpshm.c        |  1 +
 phc2sys.c       |  2 +-
 pi.c            | 20 ++++++++++++--
 port.c          | 10 +++++--
 servo.c         | 11 +++++++-
 servo.h         | 10 +++++++
 servo_private.h |  4 ++-
 10 files changed, 169 insertions(+), 48 deletions(-)

-- 
2.1.0


------------------------------------------------------------------------------
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