[Git][NTPsec/ntpsec][master] 2 commits: Fix typo: ttypes
Gary E. Miller
gitlab at mg.gitlab.com
Tue Aug 23 03:26:01 UTC 2016
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
4b791be6 by Gary E. Miller at 2016-08-22T20:24:59-07:00
Fix typo: ttypes
- - - - -
8dae7cc3 by Gary E. Miller at 2016-08-22T20:24:59-07:00
Added 50% line, label, to single offset graphs.
- - - - -
2 changed files:
- ntpstats/ntpviz
- pylib/statfiles.py
Changes:
=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -192,37 +192,56 @@ plot \
sys.stderr.write("ntpviz: WARNING: no peer data to graph\n")
return ''
peerlist.sort() # For stability of output
+ peer_data = ()
+ plot_data = ""
+ labels = ""
+ for key in peerlist:
+ # Trickiness - we allow peerlist elements to be DNS names.
+ # The socket.gethostbyname() call maps DNS names to IP addresses,
+ # passing through literal IPv4 addresses unaltered. However,
+ # it barfs on either literal IPv6 addresses or refclock names.
+ if "(" in key or "::" in key:
+ ip = key
+ else:
+ ip = socket.gethostbyname(key)
+ if ip in peerdict:
+ plot_data += "\n".join(peerdict[ip]) + "\ne\n"
+ else:
+ sys.stderr.write("ntpviz: ERROR: No such peer as %s" % key)
+ raise SystemExit(1)
+ # remove trailing "e\n"
+ plot_data = plot_data[:-2]
+
if len(peerlist) == 1:
+ # only one peer
title += ": "+ peerlist[0]
+ fifty = self.percentile(4, 50, peerdict[ip]) * 1000000
+ percentages = "\n%(fifty)s title '50th percentile', \\" \
+ % locals()
+ labels = """\
+set label 1 gprintf("50@@ = %(fifty)s us",50) at graph 0.01,0.95 left front
+""" % locals()
+
else:
title += "s"
+ percentages = ""
+
plot_template = NTPViz.Common + """\
set title "%(sitename)s: %(title)s"
set ylabel ""
set ytics format "@1.0f us" nomirror
set key top right box
-plot \\
+%(labels)s
+plot \\%(percentages)s
""" % locals()
plot_template = plot_template.replace("@", "%")
for key in peerlist:
plot_template += "'-' using 1:($%d*1000000) title '%s' with line, \\\n" % (fld, self.ip_label(key))
+ # strip the trailing ", \\n"
plot_template = plot_template[:-4] + "\n"
- for key in peerlist:
- # Trickiness - we allow peerlist elements to be DNS names.
- # The socket.gethostbyname() call maps DNS names to IP addresses,
- # passing through literal IPv4 addresses unaltered. However,
- # it barfs on either literal IPv6 addresses or refclock names.
- if "(" in key or "::" in key:
- ip = key
- else:
- ip = socket.gethostbyname(key)
- if ip in peerdict:
- plot_template += "\n".join(peerdict[ip]) + "\ne\n"
- else:
- sys.stderr.write("ntpviz: ERROR: No such peer as %s" % key)
- raise SystemExit(1)
- return plot_template[:-2]
+ plot_template += plot_data
+ return plot_template
def peer_offsets_gnuplot(self, peerlist=None):
return self.peerstats_gnuplot(peerlist, 4, "Peer clock offset")
def peer_jitters_gnuplot(self, peerlist=None):
=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -135,7 +135,7 @@ class NTPStats:
# driver type here.
if key.startswith("127.127."):
(_, _, t, u) = key.split(".")
- return "REFCLOCK(ttype=%s,unit=%s)" % (t, u)
+ return "REFCLOCK(type=%s,unit=%s)" % (t, u)
# Ordinary IP address - replace with primary hostname.
# Punt if the lookup fails.
try:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5b7553bd5c89b9527514ca63a218d908db4ebe75...8dae7cc3e442b9849f4c1d0cb03d285763843b92
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160823/99f02f1c/attachment.html>
More information about the vc
mailing list