diff options
author | wollman <wollman@FreeBSD.org> | 1993-12-21 18:36:48 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1993-12-21 18:36:48 +0000 |
commit | 8e51e9f1429efc498f923bce8b25b20f47d7c075 (patch) | |
tree | 9db10264d45dc397a38276190303093a450d769e /usr.sbin/xntpd/scripts/stats | |
download | FreeBSD-src-8e51e9f1429efc498f923bce8b25b20f47d7c075.zip FreeBSD-src-8e51e9f1429efc498f923bce8b25b20f47d7c075.tar.gz |
xntpd 3.3b from UDel
Diffstat (limited to 'usr.sbin/xntpd/scripts/stats')
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/README | 32 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/README.stats | 246 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/README.timecodes | 149 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/clock.awk | 341 | ||||
-rwxr-xr-x | usr.sbin/xntpd/scripts/stats/clock.sh | 17 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/dupe.awk | 7 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/ensemble.awk | 17 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/etf.awk | 19 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/itf.awk | 19 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/loop.awk | 49 | ||||
-rwxr-xr-x | usr.sbin/xntpd/scripts/stats/loop.sh | 13 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/peer.awk | 57 | ||||
-rwxr-xr-x | usr.sbin/xntpd/scripts/stats/peer.sh | 13 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/psummary.awk | 41 | ||||
-rwxr-xr-x | usr.sbin/xntpd/scripts/stats/summary.sh | 12 | ||||
-rw-r--r-- | usr.sbin/xntpd/scripts/stats/tdata.awk | 45 |
16 files changed, 1077 insertions, 0 deletions
diff --git a/usr.sbin/xntpd/scripts/stats/README b/usr.sbin/xntpd/scripts/stats/README new file mode 100644 index 0000000..5aa64d4 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/README @@ -0,0 +1,32 @@ +Statistics processing scripts (README) + +This directory contains a number of scripts for use with the filegen +facility. Those files ending in .awk are for the Unix awk utility, while +those ending in .sh are for the csh utility. Normally, the summary.sh +script is called from a cron job once per day. This script calls the +peer.sh script to process the peerstats file and append the summary +statistics to the peer_summary file. Then, it callse the loop.sh script +to process the loopstats file and append the summary statistics to the +loop_summary file. Finally, it calls the clock.sh script to process the +clockstats file and append the summary statistics to the clock_summary +file. + +Each of the three shell scripts peer.sh, loop.sh and clock.sh invoke +one or more awk scripts to actually produce the data. This may result +in multiple scans of the same input file. The input file is deleted after +processing. In fact, the shell scripts will process all input files +found of the correct type in chronological order, deleting each one as +it is scanned, except the current day file. + +The psummary.awk script can be used to scan the peer_summary file and +construct an historical reprise of the daily summaries. + +The file formats are documented in the README.stats file and in the +scripts themselves. Further detail on the radio clock ASCII timecode +formats and related data are in the README.timecode file. + +David L. Mills +University of Delaware +mills@udel.edu +1 November 1993 + diff --git a/usr.sbin/xntpd/scripts/stats/README.stats b/usr.sbin/xntpd/scripts/stats/README.stats new file mode 100644 index 0000000..aa8e77f --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/README.stats @@ -0,0 +1,246 @@ +Statistics file formats (README.stats) + +The xntp3 daemon can produce a variety of statistics files which are +useful for maintenance, evaluation and retrospective calibration +purposes. See the xntpd.8 man page for instructions on how to configure +this feature. Since these files can become rather large and cumbersome, +they are ordinarily reduced to summary form by running the summary.sh +shell script once per day, week or month, as appropriate. There are +three file collections presently defined: peerstats, loopstats and +clockstats, each of which is described in this note. + +peerstats + +The following data are collected in the peerstats files. The files are +reduced to summary data using the peer.sh shell script. See the peer.awk +script for further information. A line in the file is produced upon +reception of each valid update from a configured peer. + + 49236 30.756 140.173.96.1 9474 0.000603 0.37532 + + 49236 modified Julian day number + 30.756 time of day (s) past midnight UTC + 140.173.96.1 peer identifier (IP address or receiver identifier) + 9474 peer status word (hex) (see NTP specification) + 0.000603 offset (s) + 0.08929 delay (s) + 0.37532 dispersion (s) + +loopstats + +The following data are collected in the loopstats files. The files are +reduced to summary data using the loop.sh shell script. See the loop.awk +script for further information. A line in the file is produced at each +valid update of the local clock. + + 49236 11.897 -0.000004 -35.9384 0 + + 49236 modified Julian day number + 11.897 time of day (s) past midnight UTC + -0.000004 time offset (s) + -35.9384 frequency offset (ppm) + 0 phase-lock loop time constant + +clockstats + +The following data are collected in the clockstats files. The files are +reduced to summary data using the clock.sh shell script, which also +updates the ensemble, etf, itf and tdata data files as well. See the +clock.awk, ensemble.awk, etf.awk, itf.awk and tdta.awk scripts for +further information. A line in the file is produced at each valid update +received from a configured radio clock. Data are at present recorded for +several radios. The first part of each data line is similar for all +radios, e.g.: + + 49234 60517.826 127.127.4.1 93 247 16:48:21.814 + + 49234 modified Julian day number + 60517.826 time of day (s) past midnight UTC + 127.127.4.1 receiver identifier (Spectracom 8170/Netclock-2) + 93 247 16:48:21.814 timecode (format varies) + +In the case of the Austron GPS receiver, a good deal of additional +information is extracted from the radio, as described below. The formats +shown consist of one line with all the fields shown in order. The +timecode formats specific to each radio follow. See the file +README.timecodes for detailed information on the timecode formats used +by these radios. + +Spectracom 8170/Netclock-2 WWVB receiver + + 49234 60517.826 127.127.4.1 ?A93 247 16:48:21.814 + + The '?' and 'A' characters are present only when the receiver is + unsynchronized; otherwise, they are replaced by space ' ' characters. + +IRIG audio decoder + + 49234 60517.826 127.127.6.0 247 16:48:21? + + The '?' character is present only when the receiver is unsynchronized. + +Austron 2200A/2201A GPS receiver + + 49234 60580.843 127.127.10.1 93:247:16:49:24.814? + + The '?' character is present only when the receiver is unsynchronized. + +Depending on the installed options, the Austron 2200A/2201A recognizes a +number of special commands that report various data items. See the +refclock_as2201.c source module for a list of the commands used. These +data are collected only if the following line is included in the +configuration file ntp.conf: + + fudge 127.127.10.1 flag4 1 # enable extended statistics collection + +The format of each data line returned is summarized in the following +list. + +External time/frequency data (requires input buffer option IN) + +These data determine the deviations of external time/frequency inputs +relative to receiver oscillator time. The following data are typical +using an external cesium oscillator PPS and 5-MHz outputs. + + 49234 60580.843 127.127.10.1 93:247:16:49:24.814 ETF + + -85.9 time interval (ns) + -89.0 average time interval (ns) + 4.0 time interval sigma (ns) + +1.510E-11 time interval rate + -4.500E-11 deltaf/f + +1.592E-11 average deltaf/f + 5.297E-13 sigma deltaf/f + 500 number of samples + +Model and option identifiers + +These data show the receiver model number and option configuration. + + 49234 60708.848 127.127.10.1 93:247:16:51:32.817 ID;OPT;VER + + GPS 2201A model ident (must be "GPS 2200A" or "GPS 2201A") + TTY1 rs232 option present (required) + TC1 IRIG option present (optional) + LORAN LORAN assist option present (optional) + IN input buffer option present (optional) + OUT1 output buffer option present (required) + B.00 data processor software version ("B.00" or later) + B.00 signal processor software version ("B.00" or later) + 28-Apr-93 software version date ("28-Apr-93" or later) + +Internal time/frequency data + +These data determine the deviations of the receiver oscillator with +respect to satellite time. + + 49234 60564.846 127.127.10.1 93:247:16:49:08.816 ITF + + COCO current mode (must be "COCO") + 0 code coast mode (must be zero) + +6.6152E-08 code sigma (s) + -3.5053E-08 code delta t (s) + -4.0361E-11 deltat/t + -6.4746E-11 oscillator ageing rate + 500.00 loop time constant + 4.984072 electrical tuning (V) + +GPS/LORAN ensemble data (requires LORAN assist option LORAN) + +These data determine the deviations and weights to calculate ensemble +time from GPS and LORAN data. + + 49234 60596.852 127.127.10.1 93:247:16:49:40.812 LORAN ENSEMBLE + + +9.06E-08 GPS t (s) + +3.53E-08 GPS sigma (s) + .532 GPS weight + +3.71E-08 LORAN t (s) + +3.76E-08 LORAN sigma (s) + .468 LORAN weight + +6.56E-08 ensemble t + +6.94E-08 ensemble sigma (s) + +LORAN stationkeeping data (requires LORAN assist option LORAN) + +These data determine which stations of the LORAN chain are being +tracked, together with individual signal/noise ratios, deviations and +weights. + + 49234 60532.850 127.127.10.1 93:247:16:48:36.820 LORAN TDATA + + M station identifier; data follows + OK status (must be "OK" for tracking) + 0 cw flag + 0 sw flag + 1162.17 time of arrival + -4.6 snr (-30.0 if not "OK" status) + 1.67E-07 2-sample phase-time deviation + .507 weight (included only if "OK" status) + W AQ 0 0 3387.80 -31.0 station identifier and data + X OK 0 0 1740.27 -11.2 2.20E-07 .294 station identifier and data + Y OK 0 0 2180.71 -4.6 2.68E-07 .198 station identifier and data + Z CV 0 0 3392.94 -30.0 station identifier and data + +Oscillator status and environment + +These data determine the receiver oscillator type, mode, status and +environment. Nominal operating conditions are shown below. + + 49234 60628.847 127.127.10.1 93:247:16:50:12.817 OSC;ET;TEMP + + 1121 Software Control oscillator model and mode (must be + "Software Control") + Locked status (must be "Locked") + 4.979905 electrical tuning (V) + 44.81 oscillator cavity temperature + +Receiver position, status and offsets + +These data determine the receiver position and elevation, together with +programmable delay corrections for the antenna cable and receiver. + + 49234 60788.847 127.127.10.1 93:247:16:52:52.817 POS;PPS;PPSOFF + + +39:40:48.425 receiver latitude (N) + -075:45:02.392 receiver longitude (E) + +74.09 receiver elevation (m) + Stored position status (must be "Stored") + UTC PPS/PPM alignment (must be "UTC") + 0 receiver delay (ns) (should be zero for calibrated + receiver) + 200 cable delay (ns) + 0 user time bias (ns) (must be zero) + +Satellite tracking status + +These data determine how many satellites are being tracked. At the +present state of constellation development, there should be at least +three visible satellites in view. Much of the time the maximum of +seven are being tracked; rarely this number drops to two. + + 49234 60612.850 127.127.10.1 93:247:16:49:56.820 TRSTAT + + 24 T satellite prn and status (T = track, A = acquire) + 16 A 13 T 20 T 18 T 07 T 12 T list continued + +UTC leap-second information + +These data determine when the next leap second is to occur. The exact +method to use is obscure. + + 49234 60548.847 127.127.10.1 93:247:16:48:52.818 UTC + + -1.2107E-08 A0 term (s) + -1.2790E-13 A1 term (s) + +9.0000E+00 current leap seconds (s) + +2.0480E+05 time for leap seconds (s) + +2.0100E+02 week number for delta leap (weeks) + +1.9100E+02 week number for future leap (weeks) + +4.0000E+00 day number for future leap (days) + +9.0000E+00 future leap seconds (s) + +David L. Mills +University of Delaware +mills@udel.edu +23 October 1993 diff --git a/usr.sbin/xntpd/scripts/stats/README.timecodes b/usr.sbin/xntpd/scripts/stats/README.timecodes new file mode 100644 index 0000000..00b5ba5 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/README.timecodes @@ -0,0 +1,149 @@ +Radio Timecode Formats (README.timecodes) + +Following are examples of the serial timecode formats used by various +timecode receivers as given in the instruction manuals. These examples +are intended only for illustration and not as the basis of system +design. The following symbols are used to identify the timecode +character that begins a subfield. The values given after this symbol +represent the character offset from the beginning of the timecode string +as edited to remove control characters. + +C on-time character (start bit) +Y year of century +T time of day +D day of year or month/day +A alarm indicator (format specific) +Q quality indicator (format specific) +<LF> ASCII line feed (hex 0a) +<CR> ASCII carriage return (hex 0d) +<SP> ASCII space (hex 20) + +In order to promote uniform behavior in the various implementations, it +is useful to have a common interpretation of alarm conditions and signal +quality. When the alarm indicator it on, the receiver is not operating +correctly or has never synchronized to the broadcast signal. When the +alarm indicator is off and the quality indicator is on, the receiver has +synchronized to the broadcast signal, then lost the signal and is +coasting on its internal oscillator. + +In the following uppercase letters, punctuation marks and spaces <SP> +stand for themselves; lowercase letters stand for fields as described. +Special characters other than <LF>, <CR> and <SP> are preceded by ^. + +Spectracom 8170 and Netclock/2 WWV Synchonized Clock (format 0) + +"<CR><LF>i ddd hh:mm:ss TZ=zz<CR><LF>" + C A D T + + poll: ?; offsets: Y = none, D = 3, T = 7, A = 0, Q = none + i = synchronization flag (<SP> = in synch, ? = out synch) + ddd = day of year + hh:mm:ss = hours, minutes, seconds + zz = timezone offset (hours from UTC) + + Note: alarm condition is indicated by other than <SP> at A, which + occurs during initial synchronization and when received signal has + been lost for about ten hours + + example: " 216 15:36:43 TZ=0" + A D T + +Netclock/2 WWV Synchonized Clock (format 2) + +"<CR><LF>iqyy ddd hh:mm:ss.fff ld" + C AQY D T + + poll: ?; offsets: Y = 2, D = 5, T = 9, A = 0, Q = 1 + i = synchronization flag (<SP> = in synch, ? = out synch) + q = quality indicator (<SP> < 1ms, A < 10 ms, B < 100 ms, C < 500 + ms, D > 500 ms) + yy = year (as broadcast) + ddd = day of year + hh:mm:ss.fff = hours, minutes, seconds, milliseconds of day + l = leap-second warning (L indicates leap at end of month) + d = standard/daylight time indicator (<SP> standard, D daylight) + + Note: alarm condition is indicated by other than <SP> at A, which + occurs during initial synchronization and when received signal has + been lost for about ten hours; unlock condition is indicated by + other than <SP> at Q, with time since last lock indicated by the + letter code A < 13 min, B < 1.5 hr, C < 7 hr, D > 7 hr. + + example: " 92 216 15:36:43.640 D" + AQ D T + +TrueTime 468-DC Satellite Synchronized Clock (and other TrueTime +receivers) + +"<CR><LF><^A>ddd:hh:mm:ssq<CR>" + D T QC + + poll: none; offsets: Y = none, D = 0, T = 4, A = 12, Q = 12 + hh:mm:ss = hours, minutes, seconds + q = quality/alarm indicator (<SP> = locked, ? = alarm) + + Note: alarm condition is indicated by ? at A, which occurs during + initial synchronization and when received signal is lost for an + extended period; unlock condition is indicated by other than <SP> + at Q + + example: "216:15:36:43 " + D T Q + +Heath GC-1000 Most Accurate Clock (WWV/H) + +"<CR>hh:mm:ss.f dd/mm/yy<CR>" + C T A D + + poll: none; offsets: Y = none, D = 15, T = 0, A = 9, Q = none + hh:mm:ss = hours, minutes, seconds + f = deciseconds (? when out of spec) + dd/mm = day, month + yy = year of century (from DIPswitches) + + Note: 0?:??:??.? is displayed before synch is first established and + hh:mm:ss.? once synch is established and then lost again for about + a day. + + example: "15:36:43.6 04/08/91" + T A D Y + +PST/Traconex 1020 Time Source (WWV/H) (firmware revision V4.01) + +"frdzycchhSSFTttttuuxx<CR>" "ahh:mm:ss.fffs<CR>" "yy/dd/mm/ddd<CR>" + A Q T Y D + + poll: "QMQDQT"; offsets: Y = 0, D = 3 T = 1,, A = 11, Q = 13 + f = frequency enable (O = all frequencies enabled) + r = baud rate (3 = 1200, 6 = 9600) + d = features indicator (@ = month/day display enabled) + z = time zone (0 = UTC) + y = year (5 = 1991) + cc = WWV propagation delay (52 = 22 ms) + hh = WWVH propagation delay (81 = 33 ms) + SS = status (80 or 82 = operating correctly) + F = current receive frequency (1-5 = 2.5, 5, 10, 15, 20 MHz) + T = transmitter (C = WWV, H = WWVH) + tttt = time since last update (minutes) + uu = flush character (03 = ^C) + xx = 94 (unknown) (firmware revision X4.01.999 only) + + a = AM/PM indicator (A = AM, P = PM, <SP> - 24-hour format) + hh:mm:ss.fff = hours, minutes, seconds, milliseconds of day + s = daylight-saving indicator (<SP> standard, D daylight) + + yy = year of century (from DIPswitches) + dd/mm/ddd = day of month, month of year, day of year + + Note: The alarm condition is indicated by other than ? at A, which + occurs during initial synchronization and when received signal is + lost for an extended period. A receiver unlock condition is + indicated by other than "0000" in the tttt subfield at Q. + + example: "O3@055281824C00000394 91/08/04/216 15:36:43.640" + T Y D T + +David L. Mills +University of Delaware +mills@udel.edu +23 October 1993 diff --git a/usr.sbin/xntpd/scripts/stats/clock.awk b/usr.sbin/xntpd/scripts/stats/clock.awk new file mode 100644 index 0000000..f6afc99 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/clock.awk @@ -0,0 +1,341 @@ +# awk program to scan clockstat files and report errors/statistics +# +# usage: awk -f check.awk clockstats +# +# This program works for Spectracom 8170/Netclock-2 receiver, Austron +# 2200A/2201A receiver and IRIG audio decoder. It is easily adapted to +# other receivers as required. See README.austron file for additional +# information on Austron receiver. +# +BEGIN { + etf_min = osc_vmin = osc_tmin = 1e9 + etf_max = osc_vmax = osc_tmax = -1e9 +} +# +# scan all records in file +# +{ + # + # select WWVB records + # see summary for decode + # + if (NF >= 4 && $3 == "127.127.4.1") { + if ($4 == "SIGNAL" || NF > 7) + printf "%s\n", $0 + else { + wwvb_count++ + if ($4 ~ /\?/) + wwvb_x++ + else if ($4 ~ /A/) + wwvb_a++ + else if ($4 ~ /B/) + wwvb_b++ + else if ($4 ~ /C/) + wwvb_c++ + else if ($4 ~ /D/) + wwvb_d++ + } + continue + } + # + # select IRIG records + # see summary for decode + # + if (NF >= 4 && $3 == "127.127.6.0") { + irig_count++ + if ($5 ~ /\?/) + irig_error++ + continue + } + # + # select LORAN ENSEMBLE records + # see summary for decode + # + else if (NF >= 13 && $6 == "ENSEMBLE") { + ensemble_count++ + if ($9 <= 0) + ensemble_badgps++ + else if ($12 <= 0) + ensemble_badloran++ + else { + if ($13 > 200e-9 || $13 < -200e-9) + ensemble_200++ + else if ($13 > 100e-9 || $13 < -100e-9) + ensemble_100++ + ensemble_mean += $13 + ensemble_rms += $13 * $13 + } + continue + } + # + # select LORAN TDATA records + # see summary for decode; note that signal quality log is simply + # copied to output + # + else if (NF >= 7 && $6 == "TDATA") { + tdata_count++ + for (i = 7; i < NF; i++) { + if ($i == "M" && $(i+1) == "OK") { + i += 5 + m += $i + tdata_m++ + } + else if ($i == "W" && $(i+1) == "OK") { + i += 5 + w += $i + tdata_w++ + } + else if ($i == "X" && $(i+1) == "OK") { + i += 5 + x += $i + tdata_x++ + } + else if ($i == "Y" && $(i+1) == "OK") { + i += 5 + y += $i + tdata_y++ + } + else if ($i == "Z" && $(i+1) == "OK") { + i += 5 + z += $i + tdata_z++ + } + } + continue + } + # + # select ITF records + # see summary for decode + # + else if (NF >= 13 && $5 == "ITF" && $12 >= 500) { + itf_count++ + if ($9 > 200e-9 || $9 < -200e-9) + itf_200++ + else if ($9 > 100e-9 || $9 < -100e-9) + itf_100++ + itf_mean += $9 + itf_rms += $9 * $9 + itf_var += $10 * $10 + continue + } + # + # select ETF records + # see summary for decode + # + else if (NF >= 13 && $5 == "ETF" && $13 >= 500) { + etf_count++ + if ($6 > etf_max) + etf_max = $6 + else if ($6 < etf_min) + etf_min = $6 + etf_mean += $6 + etf_rms += $6 * $6 + etf_var += $9 * $9 + continue + } + # + # select TRSTAT records + # see summary for decode + # + else if (NF >= 5 && $5 == "TRSTAT") { + trstat_count++ + j = 0 + for (i = 6; i <= NF; i++) + if ($i == "T") + j++ + trstat_sat[j]++ + continue + } + # + # select ID;OPT;VER records + # + # config GPS 2201A TTY1 TC1 LORAN IN OUT1 B.00 B.00 28-Apr-93 + # + # GPS 2201A receiver model + # TTY1 rs232 moduel + # TC1 IRIG module + # LORAN LORAN assist module + # IN input module + # OUT1 output module + # B.00 B.00 firmware revision + # 28-Apr-9 firmware date3 + # + else if (NF >= 5 && $5 == "ID;OPT;VER") { + id_count++ + id_temp = "" + for (i = 6; i <= NF; i++) + id_temp = id_temp " " $i + if (id_string != id_temp) + printf "config%s\n", id_temp + id_string = id_temp + continue + } + # + # select POS;PPS;PPSOFF records + # + # position +39:40:48.425 -075:45:02.392 +74.09 Stored UTC 0 200 0 + # + # +39:40:48.425 position north latitude + # -075:45:02.392 position east longitude + # +74.09 elevation (meters) + # Stored position is stored + # UTC time is relative to UTC + # 0 200 0 PPS offsets + # + else if (NF >= 5 && $5 == "POS;PPS;PPSOFF") { + pos_count++ + pos_temp = "" + for (i = 6; i <= NF; i++) + pos_temp = pos_temp " " $i + if (pos_string != pos_temp) + printf "position%s\n", pos_temp + pos_string = pos_temp + continue + } + # + # select OSC;ET;TEMP records + # + # loop 1121 Software Control Locked + # + # 1121 oscillator type + # Software Control loop is under software control + # Locked loop is locked + # + else if (NF >= 5 && $5 == "OSC;ET;TEMP") { + osc_count++ + osc_temp = $6 " " $7 " " $8 " " $9 + if (osc_status != osc_temp) + printf "loop %s\n", osc_temp + osc_status = osc_temp + if ($10 > osc_vmax) + osc_vmax = $10 + if ($10 < osc_vmin) + osc_vmin = $10 + if ($11 > osc_tmax) + osc_tmax = $11 + if ($11 < osc_tmin) + osc_tmin = $11 + continue + } + # + # select UTC records + # these ain't ready yet + # + else if (NF >= 5 && $5 == "UTC") { + utc_count++ + utc_temp = "" + for (i = 6; i <= NF; i++) + utc_temp = utc_temp " " $i + if (utc_string != utc_temp) +# printf "utc%s\n", utc_temp + utc_string = utc_temp + continue + } +} END { +# +# ensemble summary data +# +# ensemble record count +# badgps gps data unavailable +# badloran loran data unavailable +# rms ensemble rms error (ns) +# >200 ensemble error >200 ns +# >100 100 ns < ensemble error < 200 ns +# + if (ensemble_count > 0) { + ensemble_mean /= ensemble_count + ensemble_rms = sqrt(ensemble_rms / ensemble_count - ensemble_mean * ensemble_mean) * 1e9 + printf "ensemble %d, badgps %d, badloran %d, rms %.1f, >200 %d, >100 %d\n", ensemble_count, ensemble_badgps, ensemble_badloran, ensemble_rms, ensemble_200, ensemble_100 + } +# +# wwvb summary data +# +# wwvb record count +# ? unsynchronized +# >1 error > 1 ms +# >10 error > 10 ms +# >100 error > 100 ms +# >500 error > 500 ms +# + if (wwvb_count > 0) + printf "wwvb %d, ? %d, >1 %d, >10 %d, >100 %d, >500 %d\n", wwvb_count, wwvb_x, wwvb_a, wwvb_b, wwvb_c, wwvb_d +# +# irig summary data +# +# irig record count +# err error count +# + if (irig_count > 0) + printf "irig %d, err %d\n", irig_count, irig_error +# +# tdata summary data +# +# tdata record count +# m M master OK-count, mean level (dB) +# w W slave OK-count, mean level (dB) +# x X slave OK-count, mean level (dB) +# y Y slave OK-count, mean level (dB) +# z Z slave OK-count, mean level (dB) +# + if (tdata_count > 0 ) { + if (tdata_m > 0) + m /= tdata_count + if (tdata_x > 0) + w /= tdata_count + if (tdata_x > 0) + x /= tdata_count + if (tdata_y > 0) + y /= tdata_count + if (tdata_z > 0) + z /= tdata_count + printf "tdata %d, m %d %.1f, w %d %.1f, x %d %.1f, y %d %.1f, z %d %.1f\n", tdata_count, tdata_m, m, tdata_w, w, tdata_x, x, tdata_y, y, tdata_z, z + } +# +# itf summary data +# +# itf record count +# rms itf rms error (ns) +# >200 itf error > 200 ns +# >100 itf error > 100 ns +# var Allan variance +# + if (itf_count > 1) { + itf_mean /= itf_count + itf_rms = sqrt(itf_rms / itf_count - itf_mean * itf_mean) * 1e9 + itf_var = sqrt(itf_var / (2 * (itf_count - 1))) + printf "itf %d, rms %.1f, >200 %d, >100 %d, var %.2e\n", itf_count, itf_rms, itf_200, itf_100, itf_var + } +# +# etf summary data +# +# etf record count +# mean etf mean (ns) +# rms etf rms error (ns) +# max etf maximum (ns) +# min etf minimum (ns) +# var Allan variance +# + if (etf_count > 0) { + etf_mean /= etf_count + etf_rms = sqrt(etf_rms / etf_count - etf_mean * etf_mean) + etf_var = sqrt(etf_var / (2 * (etf_count - 1))) + printf "etf %d, mean %.1f, rms %.1f, max %d, min %d, var %.2e\n", etf_count, etf_mean, etf_rms, etf_max, etf_min, etf_var + } +# +# trstat summary data +# +# trstat record count +# sat histogram of tracked satellites (0 - 7) +# + if (trstat_count > 0) + printf "trstat %d, sat %d %d %d %d %d %d %d %d\n", trstat_count, trstat_sat[0], trstat_sat[1], trstat_sat[2], trstat_sat[2], trstat_sat[3], trstat_sat[4], trstat_sat[5], trstat_sat[6], trstat_sat[7] +# +# osc summary data +# +# osc record count +# control control midrange (V) +/- deviation (mV) +# temp oven temperature midrange +/- deviation (deg C) +# + if (osc_count > 0) + printf "osc %d, control %.3f+/-%.3f, temp %.1f+/-%.2f\n", osc_count, (osc_vmax + osc_vmin) / 2, (osc_vmax - osc_vmin) / 2 * 1e3, (osc_tmax + osc_tmin) / 2, (osc_tmax - osc_tmin) / 2 +} diff --git a/usr.sbin/xntpd/scripts/stats/clock.sh b/usr.sbin/xntpd/scripts/stats/clock.sh new file mode 100755 index 0000000..1866d55 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/clock.sh @@ -0,0 +1,17 @@ +#!/bin/csh +# +# Script to summarize clockstats files +# +set x = `ls clockstats.*` +foreach dayfile ( $x ) + if ($dayfile == $x[$#x]) continue + echo " " + echo $dayfile + awk -f clock.awk $dayfile + awk -f itf.awk $dayfile >>itf + awk -f etf.awk $dayfile >>etf + awk -f ensemble.awk $dayfile >>ensemble + awk -f tdata.awk $dayfile >>tdata + rm -f $dayfile +end + diff --git a/usr.sbin/xntpd/scripts/stats/dupe.awk b/usr.sbin/xntpd/scripts/stats/dupe.awk new file mode 100644 index 0000000..3ddc1b6 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/dupe.awk @@ -0,0 +1,7 @@ +# program to delete duplicate lines in a file +# +{ + if (old != $0) + printf "%s\n", $0 + old = $0 +} diff --git a/usr.sbin/xntpd/scripts/stats/ensemble.awk b/usr.sbin/xntpd/scripts/stats/ensemble.awk new file mode 100644 index 0000000..136b33d --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/ensemble.awk @@ -0,0 +1,17 @@ +# program to produce loran ensemble statistics from clockstats files +# +# usage: awk -f ensemble.awk clockstats +# +# format of input record (time values in seconds) +# 49165 8.628 127.127.10.1 93:178:00:00:07.241 LORAN ENSEMBLE +# -6.43E-08 +5.02E-08 .091 +5.98E-08 +1.59E-08 .909 +4.85E-08 +3.52E-08 +# +# format of output record (time values in nanoseconds) +# MJD sec GPS wgt LORAN wgt avg sigma +# 49165 8.628 -64.3 0.091 59.8 0.909 48.5 35.2 +# +# select LORAN ENSEMBLE records with valid format and weights +{ + if (NF >= 14 && $6 == "ENSEMBLE" && $9 > 0 && $12 > 0) + printf "%5s %9.3f %7.1f %6.3f %7.1f %6.3f %7.1f %7.1f\n", $1, $2, $7*1e9, $9, $10*1e9, $12, $13*1e9, $14*1e9 +} diff --git a/usr.sbin/xntpd/scripts/stats/etf.awk b/usr.sbin/xntpd/scripts/stats/etf.awk new file mode 100644 index 0000000..8e6e334 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/etf.awk @@ -0,0 +1,19 @@ +# program to produce external time/frequence statistics from clockstats files +# +# usage: awk -f etf.awk clockstats +# +# format of input record +# 49165 40.473 127.127.10.1 93:178:00:00:39.238 ETF +# +175.0 +176.8 2.0 +3.729E-11 +1.000E-10 +3.511E-11 4.005E-13 500 +# +# format of output record (time values in nanoseconds) +# MJD sec time freq +# 49165 40.473 175.0 3.729e-11 +# +# select ETF records with valid format +{ + if (NF >= 9 && $5 == "ETF") { + printf "%5s %9.3f %7.1f %10.3e\n", $1, $2, $6, $9 + } +} + diff --git a/usr.sbin/xntpd/scripts/stats/itf.awk b/usr.sbin/xntpd/scripts/stats/itf.awk new file mode 100644 index 0000000..2b21c5b --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/itf.awk @@ -0,0 +1,19 @@ +# program to produce intewrnal time/frequence statistics from clockstats files +# +# usage: awk -f itf.awk clockstats +# +# format of input record +# 49227 67.846 127.127.10.1 93:240:00:00:51.816 ITF +# COCO 0 +2.0579E-07 -3.1037E-08 -7.7723E-11 +6.5455E-10 500.00 4.962819 +# +# format of output record (time values in nanoseconds) +# MJD sec time freq +# 49227 67.846 +2.0579E-07 -7.7723E-11 +# +# select ITF records with valid format +{ + if (NF >= 10 && $5 == "ITF") { + printf "%5s %9.3f %7.1f %10.3e\n", $1, $2, $8 * 1e9, $10 + } +} + diff --git a/usr.sbin/xntpd/scripts/stats/loop.awk b/usr.sbin/xntpd/scripts/stats/loop.awk new file mode 100644 index 0000000..25d0bdb --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/loop.awk @@ -0,0 +1,49 @@ +# awk program to scan loopstats files and report errors/statistics +# +# usage: awk -f loop.awk loopstats +# +# format of loopstats record +# MJD sec time (s) freq (ppm) tc +# 49235 3.943 0.000016 22.4716 0 +# +BEGIN { + loop_tmax = loop_fmax = -1e9 + loop_tmin = loop_fmin = 1e9 +} +# +# scan all records in file +# +{ + if (NF >= 5) { + loop_count++ + if ($3 > loop_tmax) + loop_tmax = $3 + if ($3 < loop_tmin) + loop_tmin = $3 + if ($4 > loop_fmax) + loop_fmax = $4 + if ($4 < loop_fmin) + loop_fmin = $4 + loop_time += $3 + loop_time_rms += $3 * $3 + loop_freq += $4 + loop_freq_rms += $4 * $4 + } +} END { + if (loop_count > 0) { + loop_time /= loop_count + loop_time_rms = sqrt(loop_time_rms / loop_count - loop_time * loop_time) + loop_freq /= loop_count + loop_freq_rms = sqrt(loop_freq_rms / loop_count - loop_freq * loop_freq) + loop_tmax = loop_tmax - loop_time + loop_tmin = loop_time - loop_tmin + if (loop_tmin > loop_tmax) + loop_tmax = loop_tmin + loop_fmax = loop_fmax - loop_freq + loop_fmin = loop_time - loop_fmin + if (loop_fmin > loop_fmax) + loop_fmax = loop_fmin + printf "loop %d, %.0f+/-%.1f, rms %.1f, freq %.2f+/-%0.3f, rms %.3f\n", loop_count, loop_time * 1e6, loop_tmax * 1e6, loop_time_rms * 1e6, loop_freq, loop_fmax, loop_freq_rms + } +} + diff --git a/usr.sbin/xntpd/scripts/stats/loop.sh b/usr.sbin/xntpd/scripts/stats/loop.sh new file mode 100755 index 0000000..619eeb8 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/loop.sh @@ -0,0 +1,13 @@ +#!/bin/csh +# +# Script to summarize loopstats files +# +set x = `ls loopstats.*` +foreach dayfile ( $x ) + if ($dayfile == $x[$#x]) continue + echo " " + echo $dayfile + awk -f loop.awk $dayfile + rm -f $dayfile +end + diff --git a/usr.sbin/xntpd/scripts/stats/peer.awk b/usr.sbin/xntpd/scripts/stats/peer.awk new file mode 100644 index 0000000..4cb48cd --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/peer.awk @@ -0,0 +1,57 @@ +# awk program to scan peerstats files and report errors/statistics +# +# usage: awk -f peer.awk peerstats +# +# format of peerstats record +# MJD sec ident stat offset (s) delay (s) disp (s) +# 49235 11.632 128.4.2.7 f414 -0.000041 0.21910 0.00084 +# +BEGIN { + n = 0 + MAXDISTANCE = 1.0 +} +# +# scan all records in file +# +{ + if (NF >= 7 && ($7 + $6 / 2) < MAXDISTANCE) { + i = n + for (j = 0; j < n; j++) { + if ($3 == peer_ident[j]) + i = j + } + if (i == n) { + peer_ident[i] = $3 + peer_tmax[i] = peer_dist[i] = -1e9 + peer_tmin[i] = 1e9 + n++ + } + peer_count[i]++ + if ($5 > peer_tmax[i]) + peer_tmax[i] = $5 + if ($5 < peer_tmin[i]) + peer_tmin[i] = $5 + dist = $7 + $6 / 2 + if (dist > peer_dist[i]) + peer_dist[i] = dist + peer_time[i] += $5 + peer_time_rms[i] += $5 * $5 + peer_delay[i] += $6 + peer_disp[i] += $7 + } +} END { + printf " ident cnt mean rms max delay dist disp\n" + printf "==========================================================================\n" + for (i = 0; i < n; i++) { + peer_time[i] /= peer_count[i] + peer_time_rms[i] = sqrt(peer_time_rms[i] / peer_count[i] - peer_time[i] * peer_time[i]) + peer_delay[i] /= peer_count[i] + peer_disp[i] /= peer_count[i] + peer_tmax[i] = peer_tmax[i] - peer_time[i] + peer_tmin[i] = peer_time[i] - peer_tmin[i] + if (peer_tmin[i] > peer_tmax[i]) + peer_tmax[i] = peer_tmin[i] + printf "%15s%5d%9.3f%9.3f%9.3f%9.3f%9.3f%9.3f\n", peer_ident[i], peer_count[i], peer_time[i] * 1e3, peer_time_rms[i] * 1e3, peer_tmax[i] * 1e3, peer_delay[i] * 1e3, peer_dist[i] * 1e3, peer_disp[i] * 1e3 + } +} + diff --git a/usr.sbin/xntpd/scripts/stats/peer.sh b/usr.sbin/xntpd/scripts/stats/peer.sh new file mode 100755 index 0000000..b5d8d29 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/peer.sh @@ -0,0 +1,13 @@ +#!/bin/csh +# +# Script to summarize peerstats files +# +set x = `ls peerstats.*` +foreach dayfile ( $x ) + if ($dayfile == $x[$#x]) continue + echo " " + echo $dayfile + awk -f peer.awk $dayfile + rm -f $dayfile +end + diff --git a/usr.sbin/xntpd/scripts/stats/psummary.awk b/usr.sbin/xntpd/scripts/stats/psummary.awk new file mode 100644 index 0000000..b7f0e92 --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/psummary.awk @@ -0,0 +1,41 @@ +# program to scan peer_summary file and produce summary of daily summaries +# +{ + if (NF < 8 || $1 == "ident") + continue + i = n + for (j = 0; j < n; j++) { + if ($1 == peer_ident[j]) + i = j + } + if (i == n) { + peer_ident[i] = $1 + n++ + } + peer_count[i]++ + if (($7 - $6 / 2) < 400) { + peer_count[i]++ + peer_mean[i] += $3 + peer_var[i] += $4 * $4 + if ($5 > peer_max[i]) + peer_max[i] = $5 + if ($5 > 1) + peer_1[i]++ + if ($5 > 5) + peer_2[i]++ + if ($5 > 10) + peer_3[i]++ + if ($5 > 50) + peer_4[i]++ + } +} END { + printf " host cnt mean rms max >1 >5 >10 >50\n" + printf "=================================================================\n" + for (i = 0; i < n; i++) { + if (peer_count[i] <= 0) + continue + peer_mean[i] /= peer_count[i] + peer_var[i] = sqrt(peer_var[i] / peer_count[i]) + printf "%15s%4d%10.3f%10.3f%10.3f%4d%4d%4d%4d\n", peer_ident[i], peer_count[i], peer_mean[i], peer_var[i], peer_max[i], peer_1[i], peer_2[i], peer_3[i], peer_4[i] + } +} diff --git a/usr.sbin/xntpd/scripts/stats/summary.sh b/usr.sbin/xntpd/scripts/stats/summary.sh new file mode 100755 index 0000000..e27ecfa --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/summary.sh @@ -0,0 +1,12 @@ +#!/bin/csh +# +# Script to summarize ipeerstats, loopstats and clockstats files +# +# This script can be run from a cron job once per day, week or month. It +# runs the file-specific summary script and appends the summary data to +# designated files. +# +peer.sh >>peer_summary +loop.sh >>loop_summary +clock.sh >>clock_summary + diff --git a/usr.sbin/xntpd/scripts/stats/tdata.awk b/usr.sbin/xntpd/scripts/stats/tdata.awk new file mode 100644 index 0000000..04d7e6a --- /dev/null +++ b/usr.sbin/xntpd/scripts/stats/tdata.awk @@ -0,0 +1,45 @@ +# program to produce loran tdata statistics from clockstats files +# +# usage: awk -f tdata.awk clockstats +# +# format of input record (missing replaced by -40.0) +# 49228 36.852 127.127.10.1 93:241:00:00:20.812 LORAN TDATA +# M OK 0 0 1169.14 -7.4 3.16E-07 .424 +# W CV 0 0 3329.30 -16.4 1.81E-06 +# X OK 0 0 1737.19 -10.5 3.44E-07 .358 +# Y OK 0 0 2182.07 -9.0 4.41E-07 .218 +# +# format of output record (signal values are in dB) +# MJD sec time M W X Y Z +# 49228 36.852 175.0 -7.4 -16.4 -10.5 -9.0 +# +# select LORAN TDATA records with valid format +{ + if (NF >= 7 && $6 == "TDATA") { + m = w = x = y = z = -40.0 + for (i = 7; i < NF - 5; i++) { + if ($i == "M" && $(i+1) == "OK") { + i += 5 + m = $i + } + else if ($i == "W" && $(i+1) == "OK") { + i += 5 + w = $i + } + else if ($i == "X" && $(i+1) == "OK") { + i += 5 + x = $i + } + else if ($i == "Y" && $(i+1) == "OK") { + i += 5 + y = $i + } + else if ($i == "Z" && $(i+1) == "OK") { + i += 5 + z = $i + } + } + printf "%5s %9.3f %6.1f %6.1f %6.1f %6.1f %6.1f\n", $1, $2, m, w, x, y, z + } +} + |