summaryrefslogtreecommitdiff
path: root/gpsprof
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-09-21 04:44:58 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-09-21 04:44:58 -0400
commit0f6f9d2d7eeca50c92b5762aa7438e3e03562cfa (patch)
tree4830497ddbaf07ac20657b25ad43716d825b1d7f /gpsprof
parent67219a3b123b0e05c24954dd769659ac17048472 (diff)
downloadgpsd-0f6f9d2d7eeca50c92b5762aa7438e3e03562cfa.tar.gz
Restore raw plot capability.
Diffstat (limited to 'gpsprof')
-rwxr-xr-xgpsprof43
1 files changed, 41 insertions, 2 deletions
diff --git a/gpsprof b/gpsprof
index 93a41b9e..5e85eaa6 100755
--- a/gpsprof
+++ b/gpsprof
@@ -184,7 +184,46 @@ plot "-" using 0:1 title "Total time" with impulses
res += self.header(session, device)
return res + self.data(session)
-formatters = (spaceplot, uninstrumented)
+class rawplot:
+ "All measurement, no deductions."
+ name = "raw"
+ def __init__(self):
+ self.stats = []
+ def gather(self, session):
+ if 'xmit_time' in session.data:
+ self.stats.append((session.data['tag'],
+ gps.misc.isotime(session.data['time']),
+ session.data['xmit_time'],
+ time.time()))
+ return True
+ def header(self, session, device):
+ res = "# Raw latency data, %s, %s, %dN%d, cycle %ds\n" % \
+ (title,
+ device['driver'], device['bps'],
+ device['stopbits'], device['cycle'])
+ return res + "\n"
+ def data(self, unused):
+ res = ""
+ for (tag, time, xmit, recv) in self.stats:
+ res += "% 8s %2.9f %2.9f %2.9f\n" % (tag, time, xmit-time, recv-time)
+ return res
+ def plot(self, unused, session, device):
+ fmt = '''
+set autoscale
+set key below
+set key title "Raw latency data, %s, %s, %dN%d, cycle %ds"
+plot \
+ "-" using 0:4 title "Reception delta" with impulses, \
+ "-" using 0:3 title "Transmission delta" with impulses
+'''
+ res = fmt % (title,
+ device['driver'], device['bps'],
+ device['stopbits'], device['cycle'])
+ res += self.header(session, device)
+ res += (self.data(session) + "e\n") * 2
+ return res
+
+formatters = (spaceplot, uninstrumented, rawplot)
def plotframe(await, fname, threshold, title):
"Return a string containing a GNUplot script "
@@ -227,7 +266,7 @@ def plotframe(await, fname, threshold, title):
device = copy.copy(session.data["devices"][0])
sys.stderr.write("found %s device @%sbps..." % (device["driver"], device["bps"]))
if session.data["class"] == "WATCH":
- if "timing" in options and not session.data.get("xmit_time"):
+ if "timing" in options and not session.data.get("timing"):
sys.stderr.write("gpsprof: timing is not enabled.\n")
sys.exit(1)
# We can get some funky artifacts at start of session