gpsd-dev
[Top][All Lists]
Advanced

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

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


From: Gary E. Miller
Subject: Re: [gpsd-dev] [PATCH] gpsprof: fix instrumented function
Date: Tue, 14 Jun 2016 18:30:09 -0700

Yo Nuno!

Confirmed.  Good catch, nice patch.  Applied and now in git head.


On Mon, 13 Jun 2016 22:35:34 +0100
Nuno Gonçalves <address@hidden> wrote:

> This fixes the following issues:
> 
> Use requires_time flag to properly recognize if gpsd is providing
> timing info or not:
> 
> gpsd compiled without timing=true, without patch:
> 
> ./gpsprof -f instrumented
> gpsprof: 15705 looking for fix...first fix in 0.69sec, gathering 100
> samples...first fix in 1.70sec, gathering 100 samples...first fix in
> 2.69sec, gathering 100 samples...first fix in 3.69sec, gathering 100
> samples...first fix in 4.69sec, gathering 100 samples...first fix in
> 5.80sec, gathering 100 samples...^
> 
> gpsd compiled without timing=true, with patch:
> 
> ./gpsprof -f instrumented
> gpsprof: 15702 looking for fix...timing is not enabled.
> 
> Do not use dropped TAG field:
> 
> gpsd compiled with timing=true, without patch:
> 
> ./gpsprof -f instrumented
> gpsprof: 19528 looking for fix...first fix in 0.70sec, gathering 100
> samples...Traceback (most recent call last):
>   File "./gpsprof", line 482, in <module>
>     plot.collect(verbose, logfp)
>   File "./gpsprof", line 139, in collect
>     if self.sample():
>   File "./gpsprof", line 371, in sample
>     self.fixes.append((self.session.data['tag'],
>   File "/home/nuno/radarcape/gpsd2/gps/client.py", line 217, in
> __getitem__ return self.__dict__[key]
> KeyError: 'tag'
> 
> Thanks,
> Nuno
> 
> 
> On Mon, Jun 13, 2016 at 7:57 PM, Gary E. Miller <address@hidden>
> wrote:
> > Yo Nuno!
> >
> > How would someone test this?
> >
> > On Mon, 13 Jun 2016 19:36:47 +0100
> > Nuno Gonçalves <address@hidden> wrote:
> >  
> >> * 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):  
> >
> >
> >
> >
> > RGDS
> > GARY
> > ---------------------------------------------------------------------------
> > Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR
> > 97703 address@hidden  Tel:+1 541 382 8588  
> 




RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

Attachment: pgpMGoX4LmSUd.pgp
Description: OpenPGP digital signature


reply via email to

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