Commit cfb90891 authored by Eric S. Raymond's avatar Eric S. Raymond
Browse files

ntpviz: use UTF-8 mu to improve legends and formats.

parent dc2edd11
......@@ -85,13 +85,13 @@ set rmargin 12
sitename = self.sitename
plot_template = NTPViz.Common + """\
set title "%(sitename)s: Local Clock Offset"
set ytics format "@1.2f us" nomirror textcolor rgb '#0060ad'
set ytics format "@1.2f μs" nomirror textcolor rgb '#0060ad'
set y2tics format "@2.3f ppm" 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*1000000) title "clock offset us" with linespoints ls 1, \
"-" using 1:($2*1000000) title "clock offset μs" with linespoints ls 1, \
"-" using 1:3 title "frequency offset ppm" with linespoints ls 2 axis x1y2
""" % locals()
return plot_template.replace('@', '%') + self.dump("loopstats") + "e\n" + self.dump("loopstats")
......@@ -160,16 +160,16 @@ plot \
nn_m_o = ninetynine - one
plot_template = NTPViz.Common + """\
set title "%(sitename)s: %(title)s"
set ytics format "@1.2f us" nomirror
set ytics format "@1.2f μs" nomirror
set key top 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 gprintf("99@@ = %(ninetynine)s us",99) at graph 0.01,0.95 left front
set label 2 gprintf("95@@ = %(ninetyfive)s us",95) at graph 0.01,0.9 left front
set label 3 gprintf(" 5@@ = %(five)s us",5) at graph 0.01,0.85 left front
set label 4 gprintf(" 1@@ = %(one)s us",1) at graph 0.01,0.8 left front
set label 5 gprintf("95@@ - 5@@ = %(nf_m_f)s us",90) at graph 0.01,0.75 left front
set label 6 gprintf("99@@ - 1@@ = %(nn_m_o)s us",98) at graph 0.01,0.7 left front
set label 1 gprintf("99@@ = %(ninetynine)s μs",99) at graph 0.01,0.95 left front
set label 2 gprintf("95@@ = %(ninetyfive)s μs",95) at graph 0.01,0.9 left front
set label 3 gprintf(" 5@@ = %(five)s μs",5) at graph 0.01,0.85 left front
set label 4 gprintf(" 1@@ = %(one)s μs",1) at graph 0.01,0.8 left front
set label 5 gprintf("95@@ - 5@@ = %(nf_m_f)s μs",90) at graph 0.01,0.75 left front
set label 6 gprintf("99@@ - 1@@ = %(nn_m_o)s μs",98) at graph 0.01,0.7 left front
plot \
"-" using 1:($%(fld)d*1000000) title "%(legend)s" with linespoints ls 1, \
%(ninetynine)s title "99th percentile", \
......@@ -214,7 +214,7 @@ plot \
# remove trailing "e\n"
plot_data = plot_data[:-2]
unit = "us"
unit = "μs"
multiplier = 1000000
if len(peerlist) == 1:
# only one peer
......@@ -290,7 +290,7 @@ plot \\%(percentages)s
plot_template = NTPViz.Common + """\
set title "%(sitename)s: offset of %(host)s"
set ylabel ""
set ytics format "@1.0f us" nomirror
set ytics format "@1.0f μs" nomirror
set key top right box
plot \
'-' using 1:($4*1000000) title 'offset' with line, \
......@@ -321,17 +321,17 @@ 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)s) at %(ninetynine)s, graph 0.91 left front offset 1,-1
set xtics format "@1.1f μs" nomirror
set label 1 gprintf("99@@ = @1.2f μs",%(ninetynine)s) at %(ninetynine)s, graph 0.91 left front offset 1,-1
set style arrow 1 nohead
set arrow from %(ninetynine)s,0 to %(ninetynine)s,graph 0.91 as 1
set label 2 gprintf(" 1@@ = @1.2f us",%(one)s) at %(one)s, graph 0.91 right front offset -1,-1
set label 2 gprintf(" 1@@ = @1.2f μs",%(one)s) at %(one)s, graph 0.91 right front offset -1,-1
set style arrow 2 nohead
set arrow from %(one)s,0 to %(one)s,graph 0.91 as 2
set label 3 gprintf("25@@ = @1.2f us",%(twentyfive)s) at %(twentyfive)s, graph 0.7 right front offset -1,-1
set label 3 gprintf("25@@ = @1.2f μs",%(twentyfive)s) at %(twentyfive)s, graph 0.7 right front offset -1,-1
set style arrow 3 nohead
set arrow from %(twentyfive)s,0 to %(twentyfive)s,graph 0.7 as 3
set label 4 gprintf("75@@ = @1.2f us",%(seventyfive)s) at %(seventyfive)s, graph 0.7 left front offset 1,-1
set label 4 gprintf("75@@ = @1.2f μs",%(seventyfive)s) at %(seventyfive)s, graph 0.7 left front offset 1,-1
set style arrow 4 nohead
set arrow from %(seventyfive)s,0 to %(seventyfive)s,graph 0.7 as 4
set key off
......@@ -352,14 +352,14 @@ def local_offset_multiplot(statlist):
"Plot comparative local offsets for a list of NTPViz objects."
plot = NTPViz.Common + '''\
set title "Local Clock Offsets"
set ytics format "@1.2f us" nomirror textcolor rgb "#0060ad"
set ytics format "@1.2f μs" nomirror textcolor rgb "#0060ad"
set key bottom right box
plot \\
'''
# FIXME: We probably need to be more flexible about computing the plot label
sitenames = [os.path.basename(os.path.dirname(d)) for d in statsdirs]
for (i, stats) in enumerate(statlist):
plot += '"-" using 1:($2*1000000) title "%s clock offset us" with linespoints, \\\n' % (sitenames[i])
plot += '"-" using 1:($2*1000000) title "%s clock offset μs" with linespoints, \\\n' % (sitenames[i])
plot = plot[:-4] + "\n"
for stats in statlist:
plot += stats.dump("loopstats") + "e\n"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment