Skip to content
Commits on Source (3)
......@@ -128,16 +128,29 @@ set rmargin 12
unit = "ns"
multiplier = 1e9
unit_f = "ppm"
multiplier_f = 1
values_f = [float(line.split()[2]) for line in self.loopstats]
values_f.sort()
ninetynine_f, one_f = \
self.percentiles( (99, 1), values_f)
if 1 > ninetynine_f and -1 < one_f:
# go to nanosec
unit_f = "ppb"
multiplier_f = 1e3
plot_template = NTPViz.Common + """\
set title "%(sitename)s: Local Clock Time/Frequency Offsets"
set ytics format "%%1.0f %(unit)s" nomirror textcolor rgb '#0060ad'
set y2tics format "%%2.3f ppm" nomirror textcolor rgb '#dd181f'
set y2tics format "%%2.0f %(unit_f)s" nomirror textcolor rgb '#dd181f'
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:($2*%(multiplier)s) title "clock offset %(unit)s" with linespoints ls 1, \
"-" using 1:3 title "frequency offset ppm" with linespoints ls 2 axis x1y2
"-" using 1:($3*%(multiplier_f)s) title "frequency offset %(unit_f)s" with linespoints ls 2 axis x1y2
""" % locals()
return plot_template + self.dump("loopstats") + "e\n" \
+ self.dump("loopstats")
......@@ -187,29 +200,40 @@ plot \\
values = [float(line.split()[2]) for line in self.loopstats]
values.sort()
multiplier = 1
unit = "ppm"
rnd = 3
ninetynine, ninetyfive, five, one = \
self.percentiles( (99,95, 5, 1), values)
ninetynine = round( ninetynine, 3)
ninetyfive = round( ninetyfive, 3)
five = round( five, 3)
one = round( one, 3)
self.percentiles( (99, 95, 5, 1), values)
if 1 > ninetynine and -1 < one:
# go to ppb
multiplier = 1e3
unit = "ppb"
rnd = 0
ninetynine = round( ninetynine * multiplier, rnd)
ninetyfive = round( ninetyfive * multiplier, rnd)
five = round( five * multiplier, rnd)
one = round( one * multiplier, rnd)
nf_m_f = ninetyfive - five
nn_m_o = ninetynine - one
plot_template = NTPViz.Common + """\
set title "%(sitename)s: Local Clock Frequency Offset"
set ytics format "%%1.3f ppm" nomirror
set ytics format "%%1.0f %(unit)s" nomirror
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
set label 1 "99%% = %(ninetynine)s ppm" at graph 0.01,0.3 left front
set label 2 "95%% = %(ninetyfive)s ppm" at graph 0.01,0.25 left front
set label 3 " 5%% = %(five)s ppm" at graph 0.01,0.2 left front
set label 4 " 1%% = %(one)s ppm" at graph 0.01,0.15 left front
set label 5 "95%% - 5%% = %(nf_m_f)s ppm" at graph 0.01,0.1 left front
set label 6 "99%% - 1%% = %(nn_m_o)s ppm" at graph 0.01,0.05 left front
set label 1 "99%% = %(ninetynine)s %(unit)s" at graph 0.01,0.3 left front
set label 2 "95%% = %(ninetyfive)s %(unit)s" at graph 0.01,0.25 left front
set label 3 " 5%% = %(five)s %(unit)s" at graph 0.01,0.2 left front
set label 4 " 1%% = %(one)s %(unit)s" at graph 0.01,0.15 left front
set label 5 "95%% - 5%% = %(nf_m_f)s %(unit)s" at graph 0.01,0.1 left front
set label 6 "99%% - 1%% = %(nn_m_o)s %(unit)s" at graph 0.01,0.05 left front
plot \
"-" using 1:3 title "local clock error" with linespoints ls 2, \
"-" using 1:($3 * %(multiplier)s) title "local clock error" with linespoints ls 2, \
%(ninetynine)s title "99th percentile", \
%(ninetyfive)s title "95th percentile", \
%(five)s title "5th percentile", \
......@@ -722,11 +746,12 @@ larger frequency offsets.</p>
""",
"local-error": """\
<p>This shows the frequency offset of the local clock. It includes
percentile data to show how much the frequency changes over a longer
period of time. The majority of this change should come from
temperature changes (ex: HVAC, the weather, CPU usage causing local
heating).</p>
<p>This shows the frequency offset of the local clock. It comes from
field 3 of the loopstats log file. The graph includes percentile data to
show how much the frequency changes over a longer period of time. The
majority of this change should come from temperature changes (ex: HVAC,
the weather, CPU usage causing local heating).</p>
<p>Smaller changes are better. An ideal result would be a flat line at 0ppm.</p>
<p>Expected values of 99%-1% percentiles: 0.4ppm</p>
""",
......@@ -767,19 +792,6 @@ how quickly the remote clock offset is changing.</p>
<p>Closer to 0μs/s is better. An ideal system would be a straight
line at 0μs/s.</p>
""",
# FIXME: Not used yet
"peer-offset-X": """\
<p>This shows the clock offset between the local clock and a remote
clock or refclock.</p>
<p>For remote clocks, the purple line is the offset while the green
and blue lines are the request and response. The request and response
lines can show if the change in offset was due to an asymmetric
network effect (either request or response latency went up/down, but
not both), a symmetric network effect (request and response latency
went in opposite directions), or the clocks changed in offset (request
and response and offset all went in the same direction).<p>
<p>The orange 50th percentile line shows the median offset value. You can use this to align offsets between LAN stratum 1 servers.</p>
"""
}
index_header = '''\
......@@ -833,6 +845,10 @@ system clock frequency (usually in parts per million, ppm)</dd>
<dt>ms, millisecond:</dt>
<dd>One thousandth of a second = 0.001s</dd>
<dt>ppb, parts per billion:</dt>
<dd>Ratio between two values. These following are all the same:
1 ppb, one in one billion, 1/1000000000, 0.000000001, and 0.0000001%</dd>
<dt>ppm, parts per million:</dt>
<dd>Ratio between two values. These following are all the same:
1 ppm, one in one million, 1/1000000, 0.000001, and 0.0001%</dd>
......