[Git][NTPsec/ntpsec][master] Deleted 1 commit: Partial implementation of --local-offset-histogram...
Eric S. Raymond
gitlab at mg.gitlab.com
Wed Aug 17 21:22:03 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below.
Deleted commits:
e03f9659 by Eric S. Raymond at 2016-08-17T17:20:13-04:00
Partial implementation of --local-offset-histogram...
...committed to avoid a bubble against Gary's current work. At this
revision HTML generation works, but only because the incomplerte new
code is commented out.
- - - - -
2 changed files:
- docs/includes/ntpviz-body.txt
- ntpstats/ntpviz
Changes:
=====================================
docs/includes/ntpviz-body.txt
=====================================
--- a/docs/includes/ntpviz-body.txt
+++ b/docs/includes/ntpviz-body.txt
@@ -8,6 +8,7 @@
{ntpviz} [-d statsdir] [-g] [-n name] [-p period]
[-s starttime] [-e endtime]
[--local-offset | --local-error | --local-jitter | --local-stability]
+ [--local-offset-histogram]
[--peer-offsets=hosts | --all-peer-offsets]
[--peer-jitters=hosts | --all-peer-jitters]
[-o outdir]
@@ -46,7 +47,7 @@ The following plots are available:
(fields 3 and 4).
--local-error::
- Clock frequency offset from the loop statistics (field 3)
+ Clock frequency offset from the loop statistics (field 4)
--local-jitter::
Clock time-jitter plot from the loop statistics (field 5).
@@ -56,6 +57,9 @@ The following plots are available:
This is deviation from a root-mean-square extrapolation of the
moving average of past frequency readings.
+--local-offset-histogram::
+ Frequency histogram of distinct loopstats time offset values (field 3).
+
--peer-offsets=host1[,host2...]::
Peer offset from local clock time from peerstats (field 4). A
comma-separated list of peer names or IP addresses must follow. It
=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -196,6 +196,41 @@ plot \
data = "\n".join(entries)
plot_template += data + "\ne\n" + data + "\ne\n" + data
return plot_template
+ def local_offset_histogram_gnuplot(self):
+ "Plot a histogram of clock offset values from loopstats."
+ sitename = self.sitename
+ cnt = collections.Counter()
+ for line in self.loopstats:
+ cnt[line.split()[1]] += 1
+ plot_template = '''\
+set terminal png size 900,600
+set grid
+set xtic rotate by -45 scale 0
+set title "%(sitename)s: Local Clock Time Offset - Histogram"
+set xtics format "@1.1f us" nomirror
+set label 1 gprintf("99@@ = @1.2f us",$NINETYNINE) at $NINETYNINE, graph 0.91 left front offset 1,-1
+set style arrow 1 nohead
+set arrow from $NINETYNINE,0 to $NINETYNINE,graph 0.91 as 1
+set label 2 gprintf(" 1@@ = @1.2f us",$ONE) at $ONE, graph 0.91 right front offset -1,-1
+set style arrow 2 nohead
+set arrow from $ONE,0 to $ONE,graph 0.91 as 2
+set label 3 gprintf("25@@ = @1.2f us",$TWENTYFIVE) at $TWENTYFIVE, graph 0.7 right front offset -1,-1
+set style arrow 3 nohead
+set arrow from $TWENTYFIVE,0 to $TWENTYFIVE,graph 0.7 as 3
+set label 4 gprintf("75@@ = @1.2f us",$SEVENTYFIVE) at $SEVENTYFIVE, graph 0.7 left front offset 1,-1
+set style arrow 4 nohead
+set arrow from $SEVENTYFIVE,0 to $SEVENTYFIVE,graph 0.7 as 4
+set key off
+set lmargin 12
+set rmargin 12
+set xrange [-20:20]
+plot \
+ "-" using (\$1/100):2 title "histogram" with boxes
+''' % locals()
+ vals = list(cnt.keys())
+ vals.sort()
+ histogram_data = ["%s %s\n" % (val, cnt[val]) for val in vals]
+ return plot_template.replace('@', '%') + "".join(histogram_data)
ntpsec_logo = """
iVBORw0KGgoAAAANSUhEUgAAAEAAAABKCAQAAACh+5ozAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAJiS0dEAP7wiPwpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFKElEQVRo3s2ZT0wcVRzHPzMLKCwsNgqLkYPSxBjbRF3TcKlC4VAhFU0AdRN7a+zBEsUEL0qImqoxMTWhBzEkTdqmREhMCgpeiiV6KVE46MVE1KQguxv/df81tLv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kfTzFN6zwJXEET9LF83QQ4RRz7vTe3gOg0McCMQQpQmyxRRRBnAX6LPa9rnsABEt8yxG6eFavC8dZYYqrxMvpZ3mRMM4Ci3ycqwhFC+qmVRYAsvWjsgX4GC2/d5SurNoK8Oo1ch9vuNFP+XN2kJjLR9Nh64asPNDEa7xKIxVNLgN8+PAzCVZRwurEGuQzGoEwr7NiUSmVQ5ouPsFPpgzkIFBlD+a2TpOF6txmPtXVMpkTCZ5d2jaDblaoABjUqy4mCcZ2+jlHK3CTt/gcxdUqmUDwIqepBzY4ykahgFbO0Q9AirCp6u8OFPz6qpvhlcLMMeZ6Wcr+iSu5E+TuTGvIyqzuA4BX5E5P5kAUrZuucSP42CDl2zHdLhYI2DmzsylhURYFd5F7fmOy5wJqaFbb7h5Q65PdGoDvrtEqz4HMAPTUfn97HZW4whKPKy14sgvf9QhoQi7ARImi8KNSlZAjgewqcCfzy0DfrGUFTPORi1c0pXGbNzObvV0PuFZgdAjd4/+DZZjBnbgzNSJ3f7rnq0AltrcCPMR4mro9a3/9Pwl2Z1Rsm9zNAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTA2LTI5VDE4OjMwOjA3LTA0OjAwZxkj2wAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0wNi0yOVQxODozMDowNy0wNDowMBZEm2cAAAAASUVORK5CYII=
@@ -205,6 +240,7 @@ if __name__ == '__main__':
try:
(options, arguments) = getopt.getopt(sys.argv[1:], "d:e:ghn:o:p:s:", [
"local-offset", "local-error", "local-jitter", "local-stability",
+ "local-offset-histogram",
"all-peer-offsets", "peer-offsets=",
"all-peer-jitters", "peer-jitters=",
"peer-rtt=",
@@ -217,7 +253,7 @@ if __name__ == '__main__':
statsdirs = ["/var/log/ntpstats"]
endtime = starttime = None
generate = False
- show_local_offset = show_local_error = show_local_jitter = show_local_stability = False
+ show_local_offset = show_local_error = show_local_jitter = show_local_stability = show_local_offset_histogram = False
show_peer_offsets = show_peer_jitters = None
show_peer_rtt = None
outdir = "ntpgraphs"
@@ -247,6 +283,8 @@ if __name__ == '__main__':
show_local_jitter = True
elif switch == "--local-stability":
show_local_stability = True
+ elif switch == "--local_offset_histogram":
+ show_local_offset_histogram = True
elif switch == "--peer-offsets":
show_peer_offsets = val.split(",")
elif switch == "--all-peer-offsets":
@@ -284,11 +322,11 @@ if __name__ == '__main__':
if len(statlist) == 1:
stats = statlist[0]
- if show_local_offset or show_local_error or show_local_jitter or show_local_stability:
+ if show_local_offset or show_local_error or show_local_jitter or show_local_stability or show_local_offset_histogram:
if not stats.loopstats:
sys.stderr.write("ntpviz: missing loopstats data\n")
raise SystemExit(1)
- if show_local_offset + show_local_error + show_local_jitter + show_local_stability > 1:
+ if show_local_offset + show_local_error + show_local_jitter + show_local_stability + show_local_offset_histogram > 1:
sys.stderr.write("ntpviz: clash of mode options\n")
raise SystemExit(1)
if show_local_offset:
@@ -299,6 +337,8 @@ if __name__ == '__main__':
plot = stats.local_offset_jitter_gnuplot()
if show_local_stability:
plot = stats.local_offset_stability_gnuplot()
+ if show_local_offset_histogram:
+ plot = stat.local_offset_histogram_gnuplot()
if generate:
gnuplot(plot)
else:
@@ -306,7 +346,7 @@ if __name__ == '__main__':
raise SystemExit(0)
if show_peer_offsets is not None or show_peer_jitters is not None or show_peer_rtt is not None:
- if not stats.loopstats:
+ if not stats.peerstats:
sys.stderr.write("ntpviz: missing peerstats data\n")
raise SystemExit(1)
if show_peer_offsets is not None:
@@ -370,6 +410,7 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
("local-error", stats.local_error_gnuplot()),
("local-jitter", stats.local_offset_jitter_gnuplot()),
("local-stability", stats.local_offset_stability_gnuplot()),
+ #("local-offset-histogram", stats.local_offset_histogram_gnuplot()),
("peer-offsets", stats.peer_offsets_gnuplot()),
]
for key in stats.peersplit().keys():
@@ -385,7 +426,7 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
with open(os.path.join(outdir, "index.html"), "w") as ifile:
ifile.write(index_header)
for (imagename, _) in imagepairs:
- ifile.write("<img src='%s.png'/>\n" % imagename)
+ ifile.write("<img src='%s.png' alt='%s plot'>\n" % (imagename, imagename.replace('-', ' ')))
ifile.write(index_trailer)
# end
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/e03f9659325dec20e78169b5a33d5b609141da67
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160817/fb4b7b85/attachment.html>
More information about the vc
mailing list