summaryrefslogtreecommitdiff
path: root/gpsprof
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-09-21 16:34:00 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-09-21 16:34:00 -0400
commit02ac9b9cd6d9416c2dd7fe9ba0d8456e0abe5316 (patch)
tree6d2587542489774f51ed0b0ac116e606be224542 /gpsprof
parent4d35b37c1f906265221363e6ba6b879cad9ab32b (diff)
downloadgpsd-02ac9b9cd6d9416c2dd7fe9ba0d8456e0abe5316.tar.gz
Refactor the raw plot to make adding new numbers easier.
Diffstat (limited to 'gpsprof')
-rwxr-xr-xgpsprof12
1 files changed, 6 insertions, 6 deletions
diff --git a/gpsprof b/gpsprof
index 85aedae7..a38b4374 100755
--- a/gpsprof
+++ b/gpsprof
@@ -209,20 +209,20 @@ class rawplot:
res += "% 8s %2.9f %2.9f %2.9f %2.9f\n" % (tag, time, start-time, xmit-start, recv-xmit)
return res
def plot(self, unused, session, device):
+ legends = ("Reception delta", "Transmission delta", "Decode time")
fmt = '''
set autoscale
set key below
set key title "Raw latency data, %s, %s, %dN%d, cycle %ds"
-plot \
- "-" using 0:5 title "Reception delta" with impulses, \
- "-" using 0:4 title "Transmission delta" with impulses, \
- "-" using 0:3 title "Decode time" with impulses
-'''
+plot '''
+ for (i, legend) in enumerate(legends):
+ fmt += '"-" using 0:%d title "%s" with impulses, ' % (i+3, legend)
+ fmt = fmt[:-2]
res = fmt % (title,
device['driver'], device['bps'],
device['stopbits'], device['cycle'])
res += self.header(session, device)
- res += (self.data(session) + "e\n") * 3
+ res += (self.data(session) + "e\n") * len(legends)
return res
formatters = (spaceplot, uninstrumented, rawplot)