summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rwxr-xr-xgpsprof62
-rw-r--r--gpsprof.xml25
3 files changed, 57 insertions, 35 deletions
diff --git a/NEWS b/NEWS
index 08f4e7cc..5ee2c2cf 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-* Fri Sep 16 2011 Eric S. Raymond <esr@snark.thyrsus.com> - 3.2~dev In
+* Thu Sep 22 2011 Eric S. Raymond <esr@snark.thyrsus.com> - 3.2~dev In
the build recipe, (1) set pkgconfig properly for 64-bit Fedora
systems, (2) clean up various derived files including *.pyc on scons
-c, (3) add an option to disable stripping of binaries (strip=no),
@@ -9,7 +9,8 @@
sniffer now accepts NMEA packets with the ECDIS packet leader 'EC'.
SBAS satellites are now properly use-flagged in SiRF and UBX skyviews.
The -G option now works under IPv6. Cross-build is now officially
- supported and instructions included.
+ supported and instructions included. gpsprof works again and does
+ whole-cycle profiling.
* Sun Aug 28 2011 Eric S. Raymond <esr@snark.thyrsus.com> - 3.1
The Irene release, rocking you like a hurricane and brought to you
diff --git a/gpsprof b/gpsprof
index 456c63f5..4d2b4312 100755
--- a/gpsprof
+++ b/gpsprof
@@ -64,7 +64,7 @@ class spaceplot:
(raw1, raw2, alt) = self.fixes[i]
res += "%f\t%f\t%f\t%f\t%f\n" % (lat, lon, raw1, raw2, alt)
return res
- def plot(self, unused, session, device):
+ def plot(self, unused, session, device, empty):
if len(self.fixes) == 0:
sys.stderr.write("No fixes collected, can't estimate accuracy.")
sys.exit(1)
@@ -171,14 +171,16 @@ class uninstrumented:
for seconds in self.stats:
res += "%2.6lf\n" % seconds
return res
- def plot(self, title, session, device):
- fmt = '''
+ def plot(self, title, session, device, dump):
+ res = ""
+ if not dump:
+ fmt = '''
set autoscale
set key below
set key title "Uninstrumented total latency, %s, %s, %dN%d, cycle %ds"
plot "-" using 0:1 title "Total time" with impulses
'''
- res = fmt % (title,
+ res = fmt % (title,
device['driver'], device['bps'],
device['stopbits'], device['cycle'])
res += self.header(session, device)
@@ -211,32 +213,35 @@ class instrumented:
rs232_time = (chars * 10.0) / device['bps']
res += "% 8s %.9f %9u %.9f %.9f %.9f %.9f\n" % (tag, time, chars, start-time, rs232_time, xmit-time, recv-time)
return res
- def plot(self, unused, session, device):
- legends = (
- "Reception delta",
- "Analysis time",
- "RS232 time",
- "Fix latency",
- )
- fmt = '''
+ def plot(self, unused, session, device, dump):
+ if dump:
+ return self.header(session, device) + self.data(session, device)
+ else:
+ legends = (
+ "Reception delta",
+ "Analysis time",
+ "RS232 time",
+ "Fix latency",
+ )
+ fmt = '''
set autoscale
set key below
set key title "Raw latency data, %s, %s, %dN%d, cycle %ds"
plot \\\n'''
- for (i, legend) in enumerate(legends):
- j = len(legends) - i + 3
- fmt += ' "-" using 0:%d title "%s" with impulses, \\\n' % (j, legend)
- fmt = fmt[:-4] + "\n"
- res = fmt % (title,
- device['driver'], device['bps'],
- device['stopbits'], device['cycle'])
- res += self.header(session, device)
- res += (self.data(session, device) + "e\n") * len(legends)
- return res
+ for (i, legend) in enumerate(legends):
+ j = len(legends) - i + 3
+ fmt += ' "-" using 0:%d title "%s" with impulses, \\\n' % (j, legend)
+ fmt = fmt[:-4] + "\n"
+ res = fmt % (title,
+ device['driver'], device['bps'],
+ device['stopbits'], device['cycle'])
+ res += self.header(session, device)
+ res += (self.data(session, device) + "e\n") * len(legends)
+ return res
formatters = (spaceplot, uninstrumented, instrumented)
-def plotframe(await, fname, threshold, title):
+def plotframe(await, fname, threshold, title, dump):
"Return a string containing a GNUplot script "
if fname:
for formatter in formatters:
@@ -297,13 +302,13 @@ def plotframe(await, fname, threshold, title):
baton.end()
finally:
session.send('?WATCH={"enable":false,"timing":false}')
- command = plotter.plot(title, session, device)
+ command = plotter.plot(title, session, device, dump)
del session
return command
if __name__ == '__main__':
try:
- (options, arguments) = getopt.getopt(sys.argv[1:], "f:hm:n:s:t:D:")
+ (options, arguments) = getopt.getopt(sys.argv[1:], "df:hm:n:s:t:D:")
formatter = "space"
raw = False
@@ -311,6 +316,7 @@ if __name__ == '__main__':
threshold = 0
await = 100
verbose = 0
+ dump = False
for (switch, val) in options:
if (switch == '-f'):
formatter = val
@@ -320,14 +326,16 @@ if __name__ == '__main__':
await = int(val)
elif (switch == '-t'):
title = val
+ elif (switch == '-d'):
+ dump = True
elif (switch == '-D'):
verbose = int(val)
elif (switch == '-h'):
sys.stderr.write(\
- "usage: gpsprof [-h] [-D debuglevel] [-m threshold] [-n samplecount] \n"
+ "usage: gpsprof [-h] [-D debuglevel] [-m threshold] [-n samplecount] [-d]\n"
+ "\t[-f {" + "|".join(map(lambda x: x.name, formatters)) + "}] [-s speed] [-t title]\n")
sys.exit(0)
- sys.stdout.write(plotframe(await,formatter,threshold,title))
+ sys.stdout.write(plotframe(await,formatter,threshold,title,dump))
except KeyboardInterrupt:
pass
diff --git a/gpsprof.xml b/gpsprof.xml
index e1d0cc8c..cf8eb493 100644
--- a/gpsprof.xml
+++ b/gpsprof.xml
@@ -26,6 +26,7 @@ BSD terms apply: see the file COPYING in the distribution root for details.
<arg choice='opt'>-m <replaceable>threshold</replaceable></arg>
<arg choice='opt'>-n <replaceable>packetcount</replaceable></arg>
<arg choice='opt'>-t <replaceable>title</replaceable></arg>
+ <arg choice='opt'>-d</arg>
<arg choice='opt'>-D <replaceable>debuglevel</replaceable></arg>
<arg choice='opt'>-h</arg>
</cmdsynopsis>
@@ -97,6 +98,10 @@ enough amount of quiet time that we can be sure we've seen the gap at
the end of the sensor's previous report-transmission cycle. Detecting
this gap requires a device running at 9600bps or faster.</para>
+<para>Similarly, EORC is end-of-reporting-cycle; when the daemon has
+seen the last sentence it needs in the reporting cycle and ready to ship
+a fix to the client.</para>
+
<para>The components of the instrumented plot are as follows:</para>
<variablelist>
@@ -107,16 +112,21 @@ this gap requires a device running at 9600bps or faster.</para>
</listitem>
</varlistentry>
<varlistentry>
-<term>Transmission delta</term>
+<term>RS232 time</term>
+<listitem>
+<para>RS232 transmission time for data shipped during the cycle
+(computed from character volume and baud rate).</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>Analysis time</term>
<listitem>
-<para>Delta between SORC and when the daemon is ready to ship a report to
-the client. Thus period includes both the device-to-daemon transmission
-time and the daemon's time to recognize the incoming packets and extract
-fix information from them.</para>
+<para>EORC, minus SORC, minus RS232 time. The amount of real time the daemon
+spent on computation rather than I/O.</para>
</listitem>
</varlistentry>
<varlistentry>
-<term>Reception delta</term>
+<term>Reception time</term>
<listitem>
<para>Shipping time from
the daemon to when it was received by <application>gpsprof</application>.</para>
@@ -136,6 +146,9 @@ is 100.</para>
<para>The -t option sets a text string to be included in the plot
title.</para>
+<para>The -d option suppresses plot generation, dumping the plot data instead.
+This option is a no-op with the space plot.</para>
+
<para>The -h option makes <application>gpsprof</application> print
a usage message and exit.</para>