summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/scripts
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1994-04-21 00:33:33 +0000
committerwollman <wollman@FreeBSD.org>1994-04-21 00:33:33 +0000
commit1185c9048d38483a3f99f3065590713d8bcda610 (patch)
tree5b64f04197cf59cf404d915ac4a06650399db240 /usr.sbin/xntpd/scripts
parentd9768fd9dbb9ffb082896c373f5e78f968079f68 (diff)
downloadFreeBSD-src-1185c9048d38483a3f99f3065590713d8bcda610.zip
FreeBSD-src-1185c9048d38483a3f99f3065590713d8bcda610.tar.gz
xntp3.3s from UDel
Diffstat (limited to 'usr.sbin/xntpd/scripts')
-rwxr-xr-xusr.sbin/xntpd/scripts/Guess.sh2
-rwxr-xr-xusr.sbin/xntpd/scripts/mkversion5
-rw-r--r--usr.sbin/xntpd/scripts/stats/README35
-rw-r--r--usr.sbin/xntpd/scripts/stats/dupe.awk3
-rw-r--r--usr.sbin/xntpd/scripts/stats/ensemble.S5
-rw-r--r--usr.sbin/xntpd/scripts/stats/etf.S15
-rw-r--r--usr.sbin/xntpd/scripts/stats/itf.S5
-rw-r--r--usr.sbin/xntpd/scripts/stats/loop.S7
-rw-r--r--usr.sbin/xntpd/scripts/stats/loop.awk10
-rw-r--r--usr.sbin/xntpd/scripts/stats/psummary.awk2
-rw-r--r--usr.sbin/xntpd/scripts/stats/rms.awk41
-rwxr-xr-xusr.sbin/xntpd/scripts/stats/summary.sh95
-rw-r--r--usr.sbin/xntpd/scripts/stats/tdata.S5
13 files changed, 192 insertions, 38 deletions
diff --git a/usr.sbin/xntpd/scripts/Guess.sh b/usr.sbin/xntpd/scripts/Guess.sh
index ba01e56..88dcb1a 100755
--- a/usr.sbin/xntpd/scripts/Guess.sh
+++ b/usr.sbin/xntpd/scripts/Guess.sh
@@ -78,7 +78,7 @@ if [ -f /bin/uname -o -f /usr/bin/uname ]; then
3.2.*)
case "$4" in
v*)
- (i386) >/dev/null 2>&1 && guess=ptx;;
+ (i386) >/dev/null 2>&1 && [ -f /usr/lib/libseq.a ] && guess=ptx;;
esac
esac
fi
diff --git a/usr.sbin/xntpd/scripts/mkversion b/usr.sbin/xntpd/scripts/mkversion
index 07dbb77..740454f 100755
--- a/usr.sbin/xntpd/scripts/mkversion
+++ b/usr.sbin/xntpd/scripts/mkversion
@@ -9,12 +9,15 @@ RUN="`expr $RUN + 1`"
echo $RUN > .version
DATE="`date`"
+TOPDIR=`echo $0 | sed -e 's;mkversion;..;'`
if [ -r VERSION ]; then
VERSION=VERSION
+else if [ -r ${TOPDIR}/VERSION ]; then
+ VERSION=${TOPDIR}/VERSION
else
VERSION=../VERSION
-fi
+fi; fi
if [ -f "$VERSION" ]; then
FLAGS="`egrep '^[0-9a-zA-Z_]+=' "$VERSION" | tr '\012' ';'` "
diff --git a/usr.sbin/xntpd/scripts/stats/README b/usr.sbin/xntpd/scripts/stats/README
index 5aa64d4..6808963 100644
--- a/usr.sbin/xntpd/scripts/stats/README
+++ b/usr.sbin/xntpd/scripts/stats/README
@@ -3,20 +3,27 @@ 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.
+script is called from a cron job once per day. This script processes the
+daily loopstats, peerstats and clockstats files produced by the daemon,
+updates the loop_summary, peer_summary and clock_summary archive files,
+and deletes the daily files.
-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.
+In the case of the Austron 2201A GPS receiver, the clockstats file
+contains a wealth of additional monitoring data. These data are summarized
+and writted to the clock_summary file, then a series of special files are
+constructed for later processing by the S utility.
+
+The summary.sh script invokes a number of 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 summary.sh script can produce input files for the S utility, if it
+is found on the search path. This utility makes PostScript graphs of the
+loopstats data for each day, as well as various statistics produced by
+the Austorn 220aA GPS receiver. The S utility is automatically run
+as a background job. Its control files have the .S extension.
The psummary.awk script can be used to scan the peer_summary file and
construct an historical reprise of the daily summaries.
@@ -29,4 +36,4 @@ David L. Mills
University of Delaware
mills@udel.edu
1 November 1993
-
+Revised 12 April 1994
diff --git a/usr.sbin/xntpd/scripts/stats/dupe.awk b/usr.sbin/xntpd/scripts/stats/dupe.awk
index 3ddc1b6..317c2a4 100644
--- a/usr.sbin/xntpd/scripts/stats/dupe.awk
+++ b/usr.sbin/xntpd/scripts/stats/dupe.awk
@@ -1,4 +1,5 @@
-# program to delete duplicate lines in a file
+#
+# delete duplicate lines
#
{
if (old != $0)
diff --git a/usr.sbin/xntpd/scripts/stats/ensemble.S b/usr.sbin/xntpd/scripts/stats/ensemble.S
new file mode 100644
index 0000000..32a4dba
--- /dev/null
+++ b/usr.sbin/xntpd/scripts/stats/ensemble.S
@@ -0,0 +1,5 @@
+ensemble <- scan(file1, list(day=0, sec=0, gps=0, gpsw=0, loran=0, loranw=0, ensemble=0, std=0))
+str <- paste("eps/", file1, ".eps", sep="")
+postscript(str, , , , 5, pointsize=18)
+par(mgp=c(1, 0, 0), tck = 0.03, mar = c(2, 2, 1, 1))
+plot(ensemble$sec, ensemble$ensemble, type="l", xlab=paste("MJD", ensemble$day, "Time (s)"), ylab="Ensemble Offset (ns)", ylim=c(-400, 400))
diff --git a/usr.sbin/xntpd/scripts/stats/etf.S b/usr.sbin/xntpd/scripts/stats/etf.S
new file mode 100644
index 0000000..9b9c68b
--- /dev/null
+++ b/usr.sbin/xntpd/scripts/stats/etf.S
@@ -0,0 +1,15 @@
+options(digits=4)
+file2 <- "etf_summary"
+etf <- scan(file1, list(day=0, sec=0, offset=0, stab=0))
+r <- lsfit(etf$sec, etf$offset)
+count<-length(etf$sec)
+mean<-r$coef[[1]]
+std<-sqrt(var(r$residuals))
+slope<-r$coef[[2]] * 1000
+cat("\n", file=file2 , append=TRUE, fill=FALSE, sep="")
+cat(file1, "\n", file=file2, append=TRUE, fill=FALSE, sep="")
+cat("etf1 ", count, ", T ", mean, " ns, R ", slope, " ps/s, std ", std, " us\n", file=file2, append=TRUE, fill=FALSE, sep="")
+str <- paste("eps/", file1, ".eps", sep="")
+postscript(str, , , , 5, pointsize=18)
+par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1))
+plot(etf$sec, etf$offset, type="l", xlab=paste("MJD", etf$day, "Time (s)"), ylab="External Offset (ns)", ylim=c(-400, 400))
diff --git a/usr.sbin/xntpd/scripts/stats/itf.S b/usr.sbin/xntpd/scripts/stats/itf.S
new file mode 100644
index 0000000..56c8c8d
--- /dev/null
+++ b/usr.sbin/xntpd/scripts/stats/itf.S
@@ -0,0 +1,5 @@
+itf <- scan(file1, list(day=0, sec=0, offset=0, stab=0))
+str <- paste("eps/", file1, ".eps", sep="")
+postscript(str, , , , 5, pointsize=18)
+par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1))
+plot(itf$sec, itf$offset, type="l", xlab=paste("MJD", itf$day, "Time (s)"), ylab="Internal Offset (ns)", ylim=c(-400, 400))
diff --git a/usr.sbin/xntpd/scripts/stats/loop.S b/usr.sbin/xntpd/scripts/stats/loop.S
new file mode 100644
index 0000000..8e564b6
--- /dev/null
+++ b/usr.sbin/xntpd/scripts/stats/loop.S
@@ -0,0 +1,7 @@
+options(digits=4)
+loop <- scan(file1, list(day=0, sec=0, offset=0, freq=0, tc=0))
+loop$offset <- loop$offset * 1e6
+str <- paste("eps/", file1, ".eps", sep="")
+postscript(str, , , , 5, pointsize=18)
+par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1))
+plot(loop$sec, loop$offset, type="l", xlab=paste("MJD", loop$day, "Time (s)"), ylab="PLL Offset (us)", ylim=c(-400, 400))
diff --git a/usr.sbin/xntpd/scripts/stats/loop.awk b/usr.sbin/xntpd/scripts/stats/loop.awk
index 25d0bdb..470b27c 100644
--- a/usr.sbin/xntpd/scripts/stats/loop.awk
+++ b/usr.sbin/xntpd/scripts/stats/loop.awk
@@ -35,15 +35,7 @@ BEGIN {
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
+ printf "loop %d, %.0f+/-%.1f, rms %.1f, freq %.2f+/-%0.3f, var %.3f\n", loop_count, (loop_tmax + loop_tmin) / 2 * 1e6, (loop_tmax - loop_tmin) / 2 * 1e6, loop_time_rms * 1e6, (loop_fmax + loop_fmin) / 2, (loop_fmax - loop_fmin) / 2, loop_freq_rms
}
}
diff --git a/usr.sbin/xntpd/scripts/stats/psummary.awk b/usr.sbin/xntpd/scripts/stats/psummary.awk
index b7f0e92..5ef8d8e 100644
--- a/usr.sbin/xntpd/scripts/stats/psummary.awk
+++ b/usr.sbin/xntpd/scripts/stats/psummary.awk
@@ -1,5 +1,7 @@
# program to scan peer_summary file and produce summary of daily summaries
#
+# usage: awk -f psummary.awk peer_summary
+#
{
if (NF < 8 || $1 == "ident")
continue
diff --git a/usr.sbin/xntpd/scripts/stats/rms.awk b/usr.sbin/xntpd/scripts/stats/rms.awk
new file mode 100644
index 0000000..34d612a
--- /dev/null
+++ b/usr.sbin/xntpd/scripts/stats/rms.awk
@@ -0,0 +1,41 @@
+# program to scan peer_summary file
+#
+{
+ 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 sd 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
index ab99f4d..caac2b0 100755
--- a/usr.sbin/xntpd/scripts/stats/summary.sh
+++ b/usr.sbin/xntpd/scripts/stats/summary.sh
@@ -1,17 +1,88 @@
-#!/bin/csh
+#!/bin/sh
#
# 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, which must be created first.
-#
-if ( -e peer_summary ) then
- peer.sh >>peer_summary
-endif
-if ( -e loop_summary ) then
- loop.sh >>loop_summary
-endif
-if ( -e clock_summary ) then
- clock.sh >>clock_summary
-endif
+# designated files.
+#
+DATE=`date +19%y%m%d`
+SIN=S.in
+SOUT=S.out
+LOOP=loop_summary
+PEER=peer_summary
+CLOCK=clock_summary
+
+rm -f $SIN $SOUT
+S=0
+if [ -f `which S | cut -f1 -d" "` ]; then
+ S=1
+fi
+#
+# Summarize loopstats files
+#
+for f in loopstats.????????; do
+ d=`echo $f | cut -f2 -d.`
+ if [ $DATE != $d ]; then
+ echo " " >>$LOOP
+ echo $f >>$LOOP
+ awk -f loop.awk $f >>$LOOP
+ if [ $S ]; then
+ echo "file1<-"\"${f}\" >>$SIN
+ echo "source("\""loop.S"\"")" >>$SIN
+ fi
+ rm -f $f
+ fi
+done
+
+#
+# Summarize peerstats files
+#
+for f in peerstats.????????; do
+ d=`echo $f | cut -f2 -d.`
+ if [ $DATE != $d ]; then
+ echo " " >>$PEER
+ echo $f >>$PEER
+ awk -f peer.awk $f >>$PEER
+ rm -f $f
+ fi
+done
+
+#
+# Summarize clockstats files
+#
+for f in clockstats.????????; do
+ d=`echo $f | cut -f2 -d.`
+ if [ $DATE != $d ]; then
+ echo " " >>$CLOCK
+ echo $f >>$CLOCK
+ awk -f clock.awk $f >>$CLOCK
+ if [ -f /dev/gps* ]; then
+ awk -f itf.awk $f >itf.$d
+ awk -f etf.awk $f >etf.$d
+ awk -f ensemble.awk $f >ensemble.$d
+ awk -f tdata.awk $f >tdata.$d
+ fi
+ rm -f $f
+ fi
+done
+
+#
+# Process clockstat files with S and generate PostScript plots
+#
+for f in itf etf ensemble tdata; do
+ for d in ${f}.????????; do
+ if [ -f $d ]; then
+ if [ $S ]; then
+ echo "file1<-"\"${d}\" >>$SIN
+ echo "source("\"${f}.S\"")" >>$SIN
+ echo "unix("\""rm ${d}"\"")" >>$SIN
+ else
+ rm -f $d
+ fi
+ fi
+ done
+done
+if [ -f $SIN ]; then
+ S BATCH $SIN $SOUT
+fi
diff --git a/usr.sbin/xntpd/scripts/stats/tdata.S b/usr.sbin/xntpd/scripts/stats/tdata.S
new file mode 100644
index 0000000..f360a24
--- /dev/null
+++ b/usr.sbin/xntpd/scripts/stats/tdata.S
@@ -0,0 +1,5 @@
+tdata <- scan(file1, list(day=0, sec=0, m=0, w=0, x=0, y=0, z=0))
+str <- paste("eps/", file1, ".eps", sep="")
+postscript(str, , , , 5, pointsize=18)
+par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1))
+plot(tdata$sec, tdata$m, type="l", xlab=paste("MJD", tdata$day, "Time (s)"), ylab="LORAN-M SNR (dB)")
OpenPOWER on IntegriCloud