---
+* [Bug 2808] GPSD_JSON driver enhancements, step 1.
+ Add a few more tallies as per Hal Murray's suggestions
* [Bug 2794] Clean up kernel clock status reports.
* [Bug 2800] refclock_true.c true_debug() can't open debug log because
of incompatible open/fdopen parameters.
<br><h4>Clockstats</h4>
<p>If flag4 is set when the driver is polled, a clockstats record
is written for the primary clock unit. (The secondary PPS unit
- does not provide clock stats yet.) The first 3 fields are the
- normal date, time, and IP address common to all clockstats
+ does not provide clock stats on its own.) The first 3 fields are
+ the normal date, time, and IP address common to all clockstats
records.
</p><p>
- The 4th field is the number of good time samples processed
- since the last poll.
- </p><p>
- The 5th field is the number of bad replies since the last
- poll. A bad reply is considered malformed when it is missing
- vital fields or the fields contain malformed data. If the data
- indicates that the GPS receiver has no valid fix the sample is
- also accounted as bad.
- </p><p>
- The 6th field is the number of received and known JSON records
- since the last poll. (<b>Note:</b> Since the sample data is
- collected from several JSON records and some JSON data is not
- related to samples, this is <i>not</i> the sum of the other
- fields.
+ <table border="1" frame="box" rules="all">
+ <th colspan="2">The Clockstats Line</th>
+ <tr> <td>field</td><td>Description</td> </tr>
+ <tr>
+ <td align="center">1</td>
+ <td>Date as day number since NTP epoch.</td>
+ </tr><tr>
+ <td align="center">2</td>
+ <td>Time as seconds since midnight.</td>
+ </tr><tr>
+ <td align="center">3</td>
+ <td>(Pseudo-) IP address of clock unit.</td>
+ </tr><tr>
+ <td align="center">4</td>
+ <td>Number of received known JSON records since last
+ poll. The driver knows about TPV, PPS, TOFF, VERSION and
+ WATCH records; others are silently ignored.
+ </td>
+ </tr><tr>
+ <td align="center">5</td>
+ <td>Bad replies since last poll. A record is considered
+ malformed or a bad reply when it is missing vital fields
+ or the fields contain malformed data that cannot be
+ parsed.
+ </td>
+ </tr><tr>
+ <td align="center">6</td>
+ <td>Number of sample cycles since last poll that were
+ discarded because there was no GPS fix. This is
+ effectively the number of TPV records with a fix value
+ < 2 or without a time stamp.
+ </td>
+ </tr><tr>
+ <td align="center">7</td>
+ <td>Number of serial time information records (TPV or TOFF,
+ depending on the GPSD version) received since last poll.
+ </td>
+ </tr><tr>
+ <td align="center">8</td>
+ <td>Number of serial time information records used for
+ clock samples since the last poll.
+ </td>
+ </tr><tr>
+ <td align="center">9</td>
+ <td>Number of PPS records received since the last poll.</td>
+ </tr><tr>
+ <td align="center">10</td>
+ <td>Number of PPS records used for clock samples on the
+ secondary channel since the last poll.
+ </td>
+ </tr>
+ </table>
</p>
<!-- --------------------------------------------------------- -->
u_int tickpres; /* timeout preset */
/* tallies for the various events */
- u_int tc_good; /* good samples received */
- u_int tc_breply; /* bad replies */
u_int tc_recv; /* received known records */
+ u_int tc_breply; /* bad replies / parsing errors */
+ u_int tc_nosync; /* TPV / sample cycles w/o fix */
+ u_int tc_sti_recv;/* received serial time info records */
+ u_int tc_sti_used;/* used --^-- */
+ u_int tc_pps_recv;/* received PPS timing info records */
+ u_int tc_pps_used;/* used --^-- */
/* log bloat throttle */
u_int logthrottle;/* seconds to next log slot */
if (pp->sloppyclockflag & CLK_FLAG4)
mprintf_clock_stats(
- &peer->srcadr,"%u %u %u",
- up->tc_good, up->tc_breply, up->tc_recv);
+ &peer->srcadr,"%u %u %u %u %u %u %u",
+ up->tc_recv,
+ up->tc_breply, up->tc_nosync,
+ up->tc_sti_recv, up->tc_sti_used,
+ up->tc_pps_recv, up->tc_pps_used);
/* clear tallies for next round */
- up->tc_good = 0;
- up->tc_breply = 0;
- up->tc_recv = 0;
+ up->tc_breply = 0;
+ up->tc_recv = 0;
+ up->tc_nosync = 0;
+ up->tc_sti_recv = 0;
+ up->tc_sti_used = 0;
+ up->tc_pps_recv = 0;
+ up->tc_pps_used = 0;
}
static void
/* use TPV reference time + PPS receive time */
add_clock_sample(peer, pp, up->sti_stamp, up->pps_recvt);
peer->precision = up->pps_prec;
- up->tc_good += 1;
+ //DEAD? up->tc_good += 1;
/* both packets consumed now... */
up->fl_pps = 0;
up->fl_sti = 0;
+ ++up->tc_sti_used;
}
}
peer->flags |= FLAG_PPS;
/* mark time stamp as burned... */
up->fl_pps2 = 0;
+ ++up->tc_pps_used;
}
}
if (up->fl_sti) {
add_clock_sample(peer, pp, up->sti_stamp, up->sti_recvt);
peer->precision = up->sti_prec;
- up->tc_good += 1;
+ //DEAD? up->tc_good += 1;
/* mark time stamp as burned... */
up->fl_sti = 0;
+ ++up->tc_sti_used;
}
}
/* accept time stamps only in 2d or 3d fix */
if (gps_mode < 2 || NULL == gps_time) {
/* receiver has no fix; tell about and avoid stale data */
- up->tc_breply += 1;
- up->fl_sti = 0;
- up->fl_pps = 0;
- up->fl_nosync = -1;
+ if ( ! up->pf_toff)
+ ++up->tc_sti_recv;
+ ++up->tc_nosync;
+ up->fl_sti = 0;
+ up->fl_pps = 0;
+ up->fl_nosync = -1;
return;
}
up->fl_nosync = 0;
* TOFF sentence is *not* available
*/
if ( ! up->pf_toff) {
+ ++up->tc_sti_recv;
/* save last time code to clock data */
save_ltc(pp, gps_time);
/* now parse the time string */
L_SUB(&up->sti_recvt, &up->sti_fudge);
up->fl_sti = -1;
} else {
- up->tc_breply += 1;
- up->fl_sti = 0;
+ ++up->tc_breply;
+ up->fl_sti = 0;
}
}
int xlog2;
+ ++up->tc_pps_recv;
+
/* Bail out if there's indication that time sync is bad or
* if we're explicitely requested to ignore PPS data.
*/
fail:
DPRINTF(1, ("%s: PPS record processing FAILED\n",
up->logname));
- up->tc_breply += 1;
+ ++up->tc_breply;
}
/* ------------------------------------------------------------------ */
clockprocT * const pp = peer->procptr;
gpsd_unitT * const up = (gpsd_unitT *)pp->unitptr;
+ ++up->tc_sti_recv;
+
/* remember this! */
up->pf_toff = -1;
fail:
DPRINTF(1, ("%s: TOFF record processing FAILED\n",
up->logname));
- up->tc_breply += 1;
+ ++up->tc_breply;
}
/* ------------------------------------------------------------------ */
process_watch(peer, &up->json_parse, rtime);
else
return; /* nothing we know about... */
- up->tc_recv += 1;
+ ++up->tc_recv;
/* if possible, feed the PPS side channel */
if (up->pps_peer)