From: Hal Murray Date: Wed, 29 Jan 2014 09:21:29 +0000 (-0500) Subject: ChangeLog: X-Git-Tag: NTP_4_2_7P417~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5885571ccfdcce67e1406ced3a01ee1a9fbd4d5;p=thirdparty%2Fntp.git ChangeLog: Bug 2539, doc extra statistics and code fixe for NMEA driver refclock_nmea.c: expand extra counters fix for missing NMEA sentence in clockstats driver20.html: document extra statistics several minor fixes bk: 52e8c819RfvAYDPyLRJFB3BzPl-Wfw --- diff --git a/ChangeLog b/ChangeLog index 4b76a3000..eebbacdaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* Bug 2539: doc and code tweaks for NMEA driver * Add check for enable stats to ntpd/complete.conf.in * Fix typo in html/confopt.html (4.2.7p415) 2014/01/28 Released by Harlan Stenn diff --git a/html/drivers/driver20.html b/html/drivers/driver20.html index 9926b22f1..c00c9e583 100644 --- a/html/drivers/driver20.html +++ b/html/drivers/driver20.html @@ -190,54 +190,83 @@ mode byte bits and bit groups Bit - Dec. + Decimal + Hex Meaning 0 1 + 1 process $GPMRC 1 2 + 2 process $GPGGA 2 4 + 4 process $GPGLL 3 8 + 8 process $GPZDA or $GPZDG 4-6 0 + 0 linespeed 4800 bps 16 + 0x10 linespeed 9600 bps 32 + 0x20 linespeed 19200 bps 48 + 0x30 linespeed 38400 bps 64 + 0x40 linespeed 57600 bps 80 + 0x50 linespeed 115200 bps 7 128 + 0x80 Write the sub-second fraction of the receive time stamp to the clockstat file for all recognised NMEA sentences. This can be used to get a useful value for fudge time2.
Caveat: This will fill your clockstat file rather fast. Use it only temporarily to get the numbers for the NMEA sentence of your choice. + + 8 + 256 + 0x100 + process $PGRMF + + 9-15 + + 0xFE00 + reserved - leave 0 + + 16 + 65536 + 0x10000 + Append extra statistics to the clockstats line. + Details below. + @@ -274,6 +303,76 @@ linespeed of 4800 bps or 9600 bps.

+

Monitor Data

+ +

The last GPS sentence that is accepted or rejected is written to the + clockstats file and available with ntpq -c clockvar. + (Logging the rejected sentences lets you see/debug why they were rejected.) + Filtered sentences are not logged.

+ +

+ If the 0x10000 mode bit is on and clockstats is enabled, several extra + counters will be appended to the NMEA sentence that gets logged. + For example: +

+56299 76876.691 127.127.20.20 $GPGGA,212116.000,3726.0785,N,12212.2605,W,1,05,2.0,17.0,M,-25.7,M,,0000*5C  228 64 0 0 64 0
+
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Clockstats
ColumnSampleMeaning
156299MJD
276876.691Time of day in seconds
3127.127.20.20IP Address from server config line
4$GPGGA,...0*5CNMEA Sentence
5228Number of sentences received
664Number of sentences accepted and used for timekeeping
70Number of sentences rejected because they were marked invalid (poor signal)
80Number of sentences rejected because of bad checksum or invalid date/time
964Number of sentences filtered by mode bits or same second
100Number of PPS pulses used, overrides NMEA sentences
+ + Sentences like $GPGSV that don't contain the time will get + counted in the total but otherwise ignored. +

Configuring NMEA Refclocks might give further useful hints for specific hardware @@ -297,11 +396,6 @@ switched on by sending the following string.

"$PGRMC,,,,,,,,,,,,2<cr><lf>"
-

Monitor Data

- -

The GPS sentence that is used is written to the clockstats file and - available with ntpq -c clockvar.

-

Fudge Factors

diff --git a/ntpd/refclock_nmea.c b/ntpd/refclock_nmea.c index 8a1d38b68..1b930ab35 100644 --- a/ntpd/refclock_nmea.c +++ b/ntpd/refclock_nmea.c @@ -87,7 +87,7 @@ #define NMEA_BAUDRATE_SHIFT 4 #define NMEA_DELAYMEAS_MASK 0x80 -#define NMEA_EXTLOG_MASK 0x01000000U +#define NMEA_EXTLOG_MASK 0x010000U #define NMEA_PROTO_IDLEN 5 /* tag name must be at least 5 chars */ #define NMEA_PROTO_MINLEN 6 /* min chars in sentence, excluding CS */ @@ -233,9 +233,10 @@ typedef struct { struct { u_int total; - u_int good; - u_int bad; - u_int filtered; + u_int accepted; + u_int rejected; /* GPS said not enough signal */ + u_int malformed; /* Bad checksum, invalid date or time */ + u_int filtered; /* mode bits, not GPZDG, same second */ u_int pps_used; } tally; @@ -847,7 +848,7 @@ nmea_receive( DPRINTF(1, ("%s checksum missing: '%s'\n", refnumtoa(&peer->srcadr), rd_lastcode)); refclock_report(peer, CEVNT_BADREPLY); - up->tally.bad++; + up->tally.malformed++; return; } @@ -934,21 +935,26 @@ nmea_receive( } /* Check sanity of time-of-day. */ - if (rc_time == 0) /* no time or conversion error? */ + if (rc_time == 0) { /* no time or conversion error? */ checkres = CEVNT_BADTIME; + up->tally.malformed++; + } /* Check sanity of date. */ - else if (rc_date == 0) /* no date or conversion error? */ + else if (rc_date == 0) {/* no date or conversion error? */ checkres = CEVNT_BADDATE; + up->tally.malformed++; + } /* check clock sanity; [bug 2143] */ - else if (pp->leap == LEAP_NOTINSYNC) /* no good status? */ + else if (pp->leap == LEAP_NOTINSYNC) { /* no good status? */ checkres = CEVNT_BADREPLY; + up->tally.rejected++; + } else checkres = -1; if (checkres != -1) { save_ltc(pp, rd_lastcode, rd_lencode); refclock_report(peer, checkres); - up->tally.bad++; return; } @@ -984,7 +990,7 @@ nmea_receive( refnumtoa(&peer->srcadr), rd_lastcode)); /* Data will be accepted. Update stats & log data. */ - up->tally.good++; + up->tally.accepted++; save_ltc(pp, rd_lastcode, rd_lencode); pp->lastrec = rd_timestamp; @@ -1087,10 +1093,13 @@ nmea_poll( */ if (peer->ttl & NMEA_EXTLOG_MASK) { /* Log & reset counters with extended logging */ + char *nmea = pp->a_lastcode; + if (*nmea == '\0') nmea = "(none)"; mprintf_clock_stats( - &peer->srcadr, "%s %u %u %u %u %u", - pp->a_lastcode, - up->tally.total, up->tally.good, up->tally.bad, + &peer->srcadr, "%s %u %u %u %u %u %u", + nmea, + up->tally.total, up->tally.accepted, + up->tally.rejected, up->tally.malformed, up->tally.filtered, up->tally.pps_used); } else { record_clock_stats(&peer->srcadr, pp->a_lastcode);