~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/request.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-11 22:14:31 UTC
  • mto: (4896.1.3 2.1.0b4-dev)
  • mto: This revision was merged to the branch mainline in revision 4898.
  • Revision ID: john@arbash-meinel.com-20091211221431-1lvz9njzb7v2qpwg
Clean up some bits, we don't really need the time reported except for end time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
293
293
            self._request_start_time = osutils.timer_func()
294
294
            self._thread_id = threading.currentThread().ident
295
295
 
296
 
    def _trace(self, action, message, extra_bytes=None, suppress_time=False):
 
296
    def _trace(self, action, message, extra_bytes=None, include_time=False):
297
297
        # It is a bit of a shame that this functionality overlaps with that of 
298
298
        # ProtocolThreeRequester._trace. However, there is enough difference
299
299
        # that just putting it in a helper doesn't help a lot. And some state
300
300
        # is taken from the instance.
301
 
        if suppress_time:
 
301
        if include_time:
 
302
            t = '%5.3fs ' % (osutils.timer_func() - self._request_start_time)
 
303
        else:
302
304
            t = ''
303
 
        else:
304
 
            t = '%5.3fs ' % (osutils.timer_func() - self._request_start_time)
305
305
        if extra_bytes is None:
306
306
            extra = ''
307
307
        else:
327
327
        # cannot read after this.
328
328
        self.finished_reading = True
329
329
        if 'hpss' in debug.debug_flags:
330
 
            self._trace('end of body', '')
 
330
            self._trace('end of body', '', include_time=True)
331
331
 
332
332
    def _run_handler_code(self, callable, args, kwargs):
333
333
        """Run some handler specific code 'callable'.
373
373
        except LookupError:
374
374
            if 'hpss' in debug.debug_flags:
375
375
                self._trace('hpss unknown request', 
376
 
                            cmd, repr(args)[1:-1],
377
 
                            suppress_time=True)
 
376
                            cmd, repr(args)[1:-1])
378
377
            raise errors.UnknownSmartMethod(cmd)
379
378
        if 'hpss' in debug.debug_flags:
380
379
            from bzrlib.smart import vfs
383
382
            else:
384
383
                action = 'hpss request'
385
384
            self._trace(action, 
386
 
                        '%s %s' % (cmd, repr(args)[1:-1]),
387
 
                        suppress_time=True)
 
385
                        '%s %s' % (cmd, repr(args)[1:-1]))
388
386
        self._command = command(
389
387
            self._backing_transport, self._root_client_path, self._jail_root)
390
388
        self._run_handler_code(self._command.execute, args, {})
395
393
            return
396
394
        self._run_handler_code(self._command.do_end, (), {})
397
395
        if 'hpss' in debug.debug_flags:
398
 
            self._trace('end', '')
 
396
            self._trace('end', '', include_time=True)
399
397
 
400
398
    def post_body_error_received(self, error_args):
401
399
        # Just a no-op at the moment.