[Git][NTPsec/ntpsec][master] ntpviz: Don't plot a line during data abcense

Gary E. Miller gitlab at mg.gitlab.com
Sat Oct 22 03:10:23 UTC 2016


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


Commits:
ff669dcd by Gary E. Miller at 2016-10-21T20:09:42-07:00
ntpviz: Don't plot a line during data abcense

If no data for more than 1024 seconds, then put a blank line in the
plot data.  Then gnuplot will not draw a line in that interval.

All that floating point, and yet no noticeable speed impact.

- - - - -


1 changed file:

- ntpstats/ntpviz


Changes:

=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -320,7 +320,13 @@ set rmargin 12
 
         # speed up by only sending gnuplot the data it will actually use
         plot_data = ''
+        last_time = 0
         for row in self.loopstats:
+            delay = float( row[0] ) - last_time
+            if 1024 < delay:
+                # data loss, add a break in the plot line
+                plot_data += '\n'
+            last_time = float(row[0] )
             # 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'
@@ -390,7 +396,13 @@ file.</p>
         plot_data = ''
         for key in tempslist:
             # speed up by only sending gnuplot the data it will actually use
+            last_time = 0
             for row in tempsmap[key]:
+                delay = float( row[0] ) - last_time
+                if 1024 < delay:
+                    # data loss, add a break in the plot line
+                    plot_data += '\n'
+                last_time = float(row[0] )
                 # Python slice is too dumb to do this the easy way
                 # fields: time, temp
                 plot_data += row[0] + ' ' + row[2] + '\n'
@@ -438,7 +450,13 @@ component of frequency drift.</p>
         gps_data = ()
         plot_data = ""
         for key in gpslist:
+            last_time = 0
             for row in gpsmap[key]:
+                delay = float( row[0] ) - last_time
+                if 1024 < delay:
+                    # data loss, add a break in the plot line
+                    plot_data += '\n'
+                last_time = float(row[0] )
                 # Python slice is too dumb to do this the easy way
                 # fields: time, tdop, nSats
                 plot_data += row[0] + ' ' + row[2] + ' ' + row[3] + '\n'
@@ -491,7 +509,13 @@ gpsd log file is created by the gps-log.py program.</p>
 
         # speed up by only sending gnuplot the data it will actually use
         plot_data = ''
+        last_time = 0
         for row in self.loopstats:
+            delay = float( row[0] ) - last_time
+            if 1024 < delay:
+                # data loss, add a break in the plot line
+                plot_data += '\n'
+            last_time = float(row[0] )
             # Python slice is too dumb to do this the easy way
             # fields: time, freq error
             plot_data += row[0] + ' ' + row[2] + '\n'
@@ -537,7 +561,13 @@ line at 0ppm.  Expected values of 99%-1% percentiles: 0.4ppm</p>
 
         # speed up by only sending gnuplot the data it will actually use
         plot_data = ''
+        last_time = 0
         for row in self.loopstats:
+            delay = float( row[0] ) - last_time
+            if 1024 < delay:
+                # data loss, add a break in the plot line
+                plot_data += '\n'
+            last_time = float(row[0] )
             # Python slice is too dumb to do this the easy way
             # fields: time, and fld
             plot_data += row[0] + ' ' + row[fld - 1] + '\n'
@@ -761,12 +791,23 @@ at 0s.</p>
             # 20% speed up by only sending gnuplot the data it will
             # actually use
             # Python slice is too dumb to do this the easy way
+            last_time = 0
             if rtt:
                 for row in peerdict[ip]:
+                    delay = float( row[0] ) - last_time
+                    if 1024 < delay:
+                        # data loss, add a break in the plot line
+                        plot_data += '\n'
+                    last_time = float(row[0] )
                     # fields: time, fld, and rtt
                     plot_data += row[0] + ' ' + row[fld-1] + ' ' + row[4] + '\n'
             else:
                 for row in peerdict[ip]:
+                    delay = float( row[0] ) - last_time
+                    if 1024 < delay:
+                        # data loss, add a break in the plot line
+                        plot_data += '\n'
+                    last_time = float(row[0] )
                     # fields: time, fld
                     plot_data += row[0] + ' ' + row[fld - 1] + '\n'
             plot_data += "e\n"



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/ff669dcd5ee45874c5e71815ff8ca9b413f5dd75
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161022/362b5831/attachment.html>


More information about the vc mailing list