[Git][NTPsec/ntpsec][master] 2 commits: ntpviz: fix --help option. % strikes again...

Gary E. Miller gitlab at mg.gitlab.com
Wed Oct 19 20:18:44 UTC 2016


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
2c10d356 by Gary E. Miller at 2016-10-19T13:18:21-07:00
ntpviz: fix --help option. % strikes again...

- - - - -
8800be5d by Gary E. Miller at 2016-10-19T13:18:21-07:00
ntpviz: fix --local-error, remove stry \n's.

- - - - -


1 changed file:

- ntpstats/ntpviz


Changes:

=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -324,7 +324,7 @@ set rmargin 12
             # Python slice is too dumb to do this the easy way
             # fields: time, time offset, and freq offset
             plot_data += row[0] + ' ' + row[1] + ' ' + row[2] + '\n'
-        plot_data += "\ne\n"
+        plot_data += "e\n"
 
         # compute clock offset
         values = [float(line[1]) for line in self.loopstats]
@@ -394,7 +394,7 @@ file.</p>
                 # Python slice is too dumb to do this the easy way
                 # fields: time, temp
                 plot_data += row[0] + ' ' + row[2] + '\n'
-            plot_data += "\ne\n"
+            plot_data += "e\n"
 
         plot_template = NTPViz.Common + """\
 set title "%(sitename)s: Local Temparatures"
@@ -442,7 +442,7 @@ component of frequency drift.</p>
                 # Python slice is too dumb to do this the easy way
                 # fields: time, tdop, nSats
                 plot_data += row[0] + ' ' + row[2] + ' ' + row[3] + '\n'
-            plot_data += "\ne\n"
+            plot_data += "e\n"
 
         plot_template = NTPViz.Common + """\
 set title "%(sitename)s: Local GPS
@@ -481,7 +481,7 @@ gpsd log file is created by the gps-log.py program.</p>
         # grab and sort the values, no need for the timestamp, etc.
 
         # compute freqency offset
-        values = [float(line.split()[2]) for line in self.loopstats]
+        values = [float(line[2]) for line in self.loopstats]
         stats = VizStats( values, "Local Clock Frequency Offset", freq=1, )
 
         # build the output dictionary, because Python can not format
@@ -489,6 +489,14 @@ gpsd log file is created by the gps-log.py program.</p>
         out = stats.percs
         out["sitename"] = self.sitename
 
+        # speed up by only sending gnuplot the data it will actually use
+        plot_data = ''
+        for row in self.loopstats:
+            # Python slice is too dumb to do this the easy way
+            # fields: time, freq error
+            plot_data += row[0] + ' ' + row[2] + '\n'
+        plot_data += "e\n"
+
         plot_template = NTPViz.Common + """\
 set title "%(sitename)s: Local Clock Frequency Offset%(clipped)s"
 set ytics format "%%1.1f %(unit)s" nomirror
@@ -497,7 +505,7 @@ set key bottom right box
 set style line 1 lc rgb '#0060ad' lt 1 lw 1 pt 7 ps 0   # --- blue
 set style line 2 lc rgb '#dd181f' lt 1 lw 1 pt 5 ps 0   # --- red
 plot \
- "-" using 1:($3 * %(multiplier)s) title "local clock error" with linespoints ls 2, \
+ "-" using 1:($2 * %(multiplier)s) title "local clock error" with linespoints ls 2, \
  %(p99)s title "99th percentile", \
  %(p95)s title "95th percentile", \
  %(p5)s title "5th percentile", \
@@ -518,7 +526,7 @@ line at 0ppm.  Expected values of 99%-1% percentiles: 0.4ppm</p>
 """
         ret = {'html' : stats.stats_html + exp, 'stats' : [stats] }
         ret['title'] = "Local Clock Frequency Offset"
-        ret['plot'] = plot_template + self.dump("loopstats") + "e\n"
+        ret['plot'] = plot_template + plot_data
         return ret
 
     def loopstats_gnuplot(self, fld, title, legend, freq):
@@ -533,7 +541,7 @@ line at 0ppm.  Expected values of 99%-1% percentiles: 0.4ppm</p>
             # Python slice is too dumb to do this the easy way
             # fields: time, fld, and rtt
             plot_data += row[0] + ' ' + row[fld - 1] + '\n'
-        plot_data += "\ne\n"
+        plot_data += "e\n"
 
         # grab and process the values
         values = [float(line[fld - 1]) for line in self.loopstats]
@@ -633,7 +641,7 @@ plot \
                     # Python slice is too dumb to do this the easy way
                     # fields: time, fld, and rtt
                     plot_data += row[0] + ' ' + row[fld - 1] + ' ' + row[4] + '\n'
-                plot_data += "\ne\n"
+                plot_data += "e\n"
             else:
                 sys.stderr.write("ntpviz: ERROR: No such peer as %s" % key)
                 raise SystemExit(1)
@@ -1004,7 +1012,7 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
                 action="store_true",
                 default = None,
                 dest='clip',
-                help="Clip plots at 1% and 99%")
+                help="Clip plots at 1%% and 99%%")
     parser.add_argument('-d', '--datadir',
                 default = "/var/log/ntpstats",
                 dest='statsdirs',
@@ -1064,7 +1072,7 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
                 default=False,
                 action="store_true",
                 dest='show_local_error',
-                help="Plot clock time and clock frequency offsets")
+                help="Plot local clock frequency offsets")
     group.add_argument( '--local-gps',
                 default = False,
                 action="store_true",
@@ -1439,7 +1447,7 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
 
         peerlist = list(stats.peersplit().keys())
         # sort for output order stability
-        peerlist = sorted( peerlist )
+        peerlist.sort()
         for key in peerlist:
             imagepairs.append(("peer-offset-" + key,
                            stats.peer_offsets_gnuplot([key])))



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/2fc89f710e57f90cdee164686b3fbfaecb0223bf...8800be5db75093a08f3882e1b3026615a2b5e66f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161019/d33898f8/attachment.html>


More information about the vc mailing list