Design plan for clockwatcher

Eric Raymond esr at snark.thyrsus.com
Wed Sep 28 17:17:00 EDT 2011


Listmembers will probably be aware that I, wearing my hat as the lead of
the GPSD project, took on the job of providing local time service 
for the bufferbloat project's network-latency profiling tools.  That
project is now pretty well wrapped up by a successful cross-development
port of GPSD to CeroWRT.  Live-testing on a WNDR3700 proves that we
can have high-quality time with a $40 GPS mouse plugged into the box's
USB port. I confidently expect future cross-dev builds on other routers 
to pose no difficulties.

I am therefore moving on to the next challenge.  I present a design sketch 
for a specialized GPSD client called "clockwatcher". It will be a daemon
indended to run in tandem with gpsd, gathering data on time drift at
the host and shipping them to a collection server.  In effect, it will
be the distributed component of Dave Taht's Cosmic Background Bufferbloat
Detector.  The data reduction at the collection server can be somebody
else's problem.

One job of clockwatcher will be to watch for events that change the
deltas between three time sources: (1) GPS time, (2) NTP-corrected
system time, and (3) uncorrected monotonic time from the host's
crystal oscillator.  Every change in deltas between these is a
potentially interesting event.  Some such events should be filtered
because they're below noise level, in particular because (a) NTP time
is expected to drift by +-10ms, and (b) the latency in GPS time
delivery jitters by about the same amount.

Another job of clockwatcher will be to watch NTP rawstats arriving at
the host and forward them to the collection server along with time
drift notifications.

Reporting will be only slightly complicated by the fact that GPS time
is not always available. My intention is to also log "GPS up" and 
"GPS down" events.  Finally, it should also log NTP up and down status.

That's the high-level view. Now for some details:

Each event will be shipped as a self-describing JSON object with a
type tag and a host source address.

The daemon will have a config file that can set the collection
server address and the minimum deltas that will trigger shipping
a notification.

On each startup, clockwatcher will ship a notification of its minimum deltas.

Best guess is this will be about a 1.5KLOC project.

Thoughts?  Comments?  Critiques?
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

The people cannot delegate to government the power to do anything
which would be unlawful for them to do themselves.
	-- John Locke, "A Treatise Concerning Civil Government"



More information about the Bloat-devel mailing list