Rev 4893: Clean up some bits, we don't really need the time reported except for end time. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-Dhpss-server
John Arbash Meinel
john at arbash-meinel.com
Fri Dec 11 22:14:35 GMT 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1-Dhpss-server
------------------------------------------------------------
revno: 4893
revision-id: john at arbash-meinel.com-20091211221431-1lvz9njzb7v2qpwg
parent: john at arbash-meinel.com-20091211215703-zxl1ygia6mlnvfyo
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-Dhpss-server
timestamp: Fri 2009-12-11 16:14:31 -0600
message:
Clean up some bits, we don't really need the time reported except for end time.
-------------- next part --------------
=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py 2009-12-11 21:57:03 +0000
+++ b/bzrlib/smart/protocol.py 2009-12-11 22:14:31 +0000
@@ -1146,13 +1146,13 @@
self._thread_id = threading.currentThread().ident
self._response_start_time = None
- def _trace(self, action, message, extra_bytes=None, suppress_time=False):
+ def _trace(self, action, message, extra_bytes=None, include_time=False):
if self._response_start_time is None:
self._response_start_time = osutils.timer_func()
- if suppress_time:
+ if include_time:
+ t = '%5.3fs ' % (time.clock() - self._response_start_time)
+ else:
t = ''
- else:
- t = '%5.3fs ' % (time.clock() - self._response_start_time)
if extra_bytes is None:
extra = ''
else:
@@ -1194,13 +1194,13 @@
else:
self._write_error_status()
if 'hpss' in debug.debug_flags:
- self._trace('response', repr(response.args), suppress_time=True)
+ self._trace('response', repr(response.args))
self._write_structure(response.args)
if response.body is not None:
self._write_prefixed_body(response.body)
if 'hpss' in debug.debug_flags:
self._trace('body', '%d bytes' % (len(response.body),),
- response.body)
+ response.body, include_time=True)
elif response.body_stream is not None:
count = num_bytes = 0
first_chunk = None
@@ -1227,9 +1227,12 @@
'%d bytes' % (len(chunk),),
chunk, suppress_time=True)
if 'hpss' in debug.debug_flags:
- self._trace('body', '%d bytes %d chunks' % (num_bytes, count),
- response.body)
+ self._trace('body stream',
+ '%d bytes %d chunks' % (num_bytes, count),
+ first_chunk)
self._write_end()
+ if 'hpss' in debug.debug_flags:
+ self._trace('response end', '', include_time=True)
def _iter_with_errors(iterable):
=== modified file 'bzrlib/smart/request.py'
--- a/bzrlib/smart/request.py 2009-12-11 21:57:03 +0000
+++ b/bzrlib/smart/request.py 2009-12-11 22:14:31 +0000
@@ -293,15 +293,15 @@
self._request_start_time = osutils.timer_func()
self._thread_id = threading.currentThread().ident
- def _trace(self, action, message, extra_bytes=None, suppress_time=False):
+ def _trace(self, action, message, extra_bytes=None, include_time=False):
# It is a bit of a shame that this functionality overlaps with that of
# ProtocolThreeRequester._trace. However, there is enough difference
# that just putting it in a helper doesn't help a lot. And some state
# is taken from the instance.
- if suppress_time:
+ if include_time:
+ t = '%5.3fs ' % (osutils.timer_func() - self._request_start_time)
+ else:
t = ''
- else:
- t = '%5.3fs ' % (osutils.timer_func() - self._request_start_time)
if extra_bytes is None:
extra = ''
else:
@@ -327,7 +327,7 @@
# cannot read after this.
self.finished_reading = True
if 'hpss' in debug.debug_flags:
- self._trace('end of body', '')
+ self._trace('end of body', '', include_time=True)
def _run_handler_code(self, callable, args, kwargs):
"""Run some handler specific code 'callable'.
@@ -373,8 +373,7 @@
except LookupError:
if 'hpss' in debug.debug_flags:
self._trace('hpss unknown request',
- cmd, repr(args)[1:-1],
- suppress_time=True)
+ cmd, repr(args)[1:-1])
raise errors.UnknownSmartMethod(cmd)
if 'hpss' in debug.debug_flags:
from bzrlib.smart import vfs
@@ -383,8 +382,7 @@
else:
action = 'hpss request'
self._trace(action,
- '%s %s' % (cmd, repr(args)[1:-1]),
- suppress_time=True)
+ '%s %s' % (cmd, repr(args)[1:-1]))
self._command = command(
self._backing_transport, self._root_client_path, self._jail_root)
self._run_handler_code(self._command.execute, args, {})
@@ -395,7 +393,7 @@
return
self._run_handler_code(self._command.do_end, (), {})
if 'hpss' in debug.debug_flags:
- self._trace('end', '')
+ self._trace('end', '', include_time=True)
def post_body_error_received(self, error_args):
# Just a no-op at the moment.
More information about the bazaar-commits
mailing list