diff options
-rwxr-xr-x | gpsprof | 23 | ||||
-rw-r--r-- | gpsprof.xml | 46 | ||||
-rw-r--r-- | libgpsd_core.c | 4 |
3 files changed, 60 insertions, 13 deletions
@@ -184,9 +184,9 @@ plot "-" using 0:1 title "Total time" with impulses res += self.header(session, device) return res + self.data(session) -class rawplot: +class instrumented: "All measurement, no deductions." - name = "raw" + name = "instrumented" def __init__(self): self.stats = [] def gather(self, session): @@ -198,7 +198,7 @@ class rawplot: time.time())) return True def header(self, session, device): - res = "# Raw latency data, %s, %s, %dN%d, cycle %ds\n" % \ + res = "# Instrumented latency data, %s, %s, %dN%d, cycle %ds" % \ (title, device['driver'], device['bps'], device['stopbits'], device['cycle']) @@ -209,15 +209,19 @@ 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") + legends = ( + "Fix latency", + "Transmission delta", + "Reception delta", + ) fmt = ''' set autoscale set key below set key title "Raw latency data, %s, %s, %dN%d, cycle %ds" -plot ''' +plot \\\n''' for (i, legend) in enumerate(legends): - fmt += '"-" using 0:%d title "%s" with impulses, ' % (i+3, legend) - fmt = fmt[:-2] + fmt += ' "-" using 0:%d title "%s" with impulses, \\\n' % (i+3, legend) + fmt = fmt[:-4] + "\n" res = fmt % (title, device['driver'], device['bps'], device['stopbits'], device['cycle']) @@ -225,7 +229,7 @@ plot ''' res += (self.data(session) + "e\n") * len(legends) return res -formatters = (spaceplot, uninstrumented, rawplot) +formatters = (spaceplot, uninstrumented, instrumented) def plotframe(await, fname, threshold, title): "Return a string containing a GNUplot script " @@ -271,6 +275,9 @@ def plotframe(await, fname, threshold, title): if "timing" in options and not session.data.get("timing"): sys.stderr.write("gpsprof: timing is not enabled.\n") sys.exit(1) + # Ignore everything but TPVs for the moment + if session.data["class"] != "TPV": + continue # We can get some funky artifacts at start of session # apparently due to RS232 buffering effects. Ignore # them. diff --git a/gpsprof.xml b/gpsprof.xml index 194298d0..e1d0cc8c 100644 --- a/gpsprof.xml +++ b/gpsprof.xml @@ -68,7 +68,6 @@ Currently the following plot types are defined:</para> circle. This data is only meaningful if the GPS is held stationary while <application>gpsprof</application> is running. This is the default.</para> -<para></para> </listitem> </varlistentry> <varlistentry> @@ -82,17 +81,54 @@ from reports without fixes is lumped in.</para> </listitem> </varlistentry> <varlistentry> -<term>raw</term> +<term>instrumented</term> <listitem> -<para>Plot raw data.</para> +<para>Plot instrumented profile. +Plots various components of the total latency between the GPS's fix time +fix and when the client receives the fix.</para> +</listitem> +</varlistentry> +</variablelist> + +<para>For purposes of the description, below, start-of-reporting-cycle +(SORC) is when a device's reporting cycle begins. This time is +detected by watching to see when data availability follows a long +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>The components of the instrumented plot are as follows:</para> + +<variablelist> +<varlistentry> +<term>Fix latency</term> +<listitem> +<para>Delta between GPS time and SORC.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Transmission delta</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> +</listitem> +</varlistentry> +<varlistentry> +<term>Reception delta</term> +<listitem> +<para>Shipping time from +the daemon to when it was received by <application>gpsprof</application>.</para> </listitem> </varlistentry> </variablelist> <para>Because of RS232 buffering effects, the profiler sometimes generates reports of ridiculously high latencies right at the -beginning of a session. The -m option lets you set a latency threshold, in -multiples of the cycle time, above which reports are discarded.</para> +beginning of a session. The -m option lets you set a latency +threshold, in multiples of the cycle time, above which reports are +discarded.</para> <para>The -n option sets the number of packets to sample. The default is 100.</para> diff --git a/libgpsd_core.c b/libgpsd_core.c index 0994f632..a482ea75 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -815,6 +815,9 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) #ifdef TIMING_ENABLE /* + * Input just gecame available from a sensor, but no read from the + * device has yet been done. + * * If we ever want a start-of-packet timestamp again, take it here * with a test that session->packet.outbuflen is zero. * @@ -852,6 +855,7 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) #define MINIMUM_QUIET_TIME 0.25 if (session->packet.outbuflen == 0) { + /* beginning of a new packet */ timestamp_t now = timestamp(); if (session->device_type != NULL && session->packet.start_time > 0) { double quiet_time = (MINIMUM_QUIET_TIME * session->device_type->min_cycle); |