gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH] gpsprof: fix instrumented function


From: Nuno Gonçalves
Subject: [gpsd-dev] [PATCH] gpsprof: fix instrumented function
Date: Mon, 13 Jun 2016 19:36:47 +0100

* use requires_time flag
* do not use dropped TAG field.

Signed-off-by: Nuno Goncalves <address@hidden>
---
 gpsprof | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/gpsprof b/gpsprof
index 1f1b29c..a1402b9 100755
--- a/gpsprof
+++ b/gpsprof
@@ -118,7 +118,7 @@ class plotter(object):
                         if self.device['path'] == device:
                             break
                 if self.session.data["class"] == "WATCH":
-                    if "timing" in options and not
self.session.data.get("timing"):
+                    if self.requires_time and not
self.session.data.get("timing"):
                         sys.stderr.write("timing is not enabled.\n")
                         sys.exit(1)
                 # Log before filtering - might be good for post-analysis.
@@ -134,9 +134,9 @@ class plotter(object):
                     continue
                 if self.session.fix.mode <= gps.MODE_NO_FIX:
                     continue
-                if countdown == await:
-                    sys.stderr.write("first fix in %.2fsec, gathering
%d samples..." % (time.time() - basetime, await))
                 if self.sample():
+    if countdown == await:
+                        sys.stderr.write("first fix in %.2fsec,
gathering %d samples..." % (time.time() - basetime, await))
                     countdown -= 1
             baton.end()
         finally:
@@ -368,8 +368,7 @@ class instrumented(plotter):

     def sample(self):
         if 'rtime' in self.session.data:
-            self.fixes.append((self.session.data['tag'],
-                               gps.misc.isotime(self.session.data['time']),
+            self.fixes.append((gps.misc.isotime(self.session.data['time']),
                                self.session.data["chars"],
                                self.session.data['sats'],
                                self.session.data['sor'],
@@ -381,7 +380,7 @@ class instrumented(plotter):

     def header(self):
         res = "# Analyzed latency, " + self.whatami() + "\n"
-        res += "# Tag   -- Fix time --  - Chars -  --   Latency  -
RS232-  Analysis  - Recv -\n"
+        res += "#-- Fix time --  - Chars -  --   Latency  - RS232-
Analysis  - Recv -\n"
         return res

     def postprocess(self):
@@ -389,9 +388,9 @@ class instrumented(plotter):

     def data(self):
         res = ""
-        for (tag, fix_time, chars, sats, start, xmit, recv) in self.fixes:
+        for (fix_time, chars, sats, start, xmit, recv) in self.fixes:
             rs232_time = (chars * 10.0) / self.device['bps']
-            res += "%-6s  %.3f  %9u  %2u  %.6f  %.6f  %.6f  %.6f\n" %
(tag, fix_time, chars, sats, start - fix_time, (start - fix_time) +
rs232_time, xmit - fix_time, recv - fix_time)
+            res += "%.3f  %9u  %2u  %.6f  %.6f  %.6f  %.6f\n" %
(fix_time, chars, sats, start - fix_time, (start - fix_time) +
rs232_time, xmit - fix_time, recv - fix_time)
         return res

     def plot(self):
-- 
2.7.4

Attachment: 0001-gpsprof-fix-instrumented-function.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]