diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-02-17 22:33:46 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-02-17 22:33:46 +0000 |
commit | e7896e4eb16d3d6282c20aef0352d5f95cc25b81 (patch) | |
tree | 897a2cb1b4aedd41f3e724028e72f87966f80cf7 /gpsprof | |
parent | 4656b7eb011cc3f82228e9a44d26c713c30a3181 (diff) | |
download | gpsd-e7896e4eb16d3d6282c20aef0352d5f95cc25b81.tar.gz |
Added gsprof -m option.
Diffstat (limited to 'gpsprof')
-rwxr-xr-x | gpsprof | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -106,15 +106,15 @@ class splitplot: def __init__(self): self.found = {} def header(self, fp): - fp.write("# Filtered latency data, %s, %dN%d, cycle %ds\n" % \ + fp.write("# Split latency data, %s, %dN%d, cycle %ds\n" % \ (title, session.baudrate, session.stopbits, session.cycle)) fp.write("#") for s in splitplot.sentences: fp.write("%8s\t" % s) - for hn in ("T1", "D1", "W", "E2", "T2", "D2"): + for hn in ("T1", "D1", "W", "E2", "T2", "D2", "length"): fp.write("%8s\t" % hn) fp.write("tag\n# ") - for s in splitplot.sentences + ("T1", "D1", "W", "E2", "T2", "D2"): + for s in splitplot.sentences + ("T1", "D1", "W", "E2", "T2", "D2", "length"): fp.write("---------\t") fp.write("--------\n") def formatter(self, session, fp): @@ -124,13 +124,14 @@ class splitplot: self.found[s] = True else: fp.write("- \t") - fp.write("%2.6f %2.6f %2.6f %2.6f %2.6f %2.6f # %s\n" \ + fp.write("%2.6f %2.6f %2.6f %2.6f %2.6f %2.6f %8d # %s\n" \ % (session.d_recv_time, session.d_decode_time, session.poll_time, session.emit_time, session.c_recv_time, session.c_decode_time, + session.length, session.tag)) return True def plot(self, file, title, session): @@ -164,13 +165,14 @@ plot \\ formatters = (rawplot, splitplot, uninstrumented) if __name__ == '__main__': - (options, arguments) = getopt.getopt(sys.argv[1:], "f:hn:o:rs:t:T:") + (options, arguments) = getopt.getopt(sys.argv[1:], "f:hm:n:o:rs:t:T:") formatter = splitplot raw = False file = None speed = 0 terminal = None title = time.ctime() + threshold = 0 await = 100 for (switch, val) in options: if (switch == '-f'): @@ -180,6 +182,8 @@ if __name__ == '__main__': else: sys.stderr.write("gpsprof: no such formatter.\n") sys.exit(1) + elif (switch == '-m'): + threshold = int(val) elif (switch == '-n'): await = int(val) elif (switch == '-o'): @@ -193,8 +197,9 @@ if __name__ == '__main__': elif (switch == '-T'): terminal = val elif (switch == '-h'): - sys.stderr.write("usage: gpsprof [-h] [-r] [-n samplecount] " - + "[-f {" + "|".join(map(lambda x: x.name, formatters)) + "}] [-s speed] [-t title] [-o file]\n") + sys.stderr.write(\ + "usage: gpsprof [-h] [-r] [-m threshold] [-n samplecount] \n" + + "\t[-f {" + "|".join(map(lambda x: x.name, formatters)) + "}] [-s speed] [-t title] [-o file]\n") sys.exit(0) plotter = formatter() if file: @@ -226,9 +231,9 @@ if __name__ == '__main__': # If timestamp is no good, skip it. if session.utc == "?": continue - # We can get some funky artifacts at start of session apparrently + # We can get some funky artifacts at start of session apparently # due to RS232 buffering effects. Ignore them. - if session.c_decode_time > 3: + if threshold and session.c_decode_time > session.cycle * threshold: continue if plotter.formatter(session, out): await -= 1 |