~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.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:
1146
1146
            self._thread_id = threading.currentThread().ident
1147
1147
            self._response_start_time = None
1148
1148
 
1149
 
    def _trace(self, action, message, extra_bytes=None, suppress_time=False):
 
1149
    def _trace(self, action, message, extra_bytes=None, include_time=False):
1150
1150
        if self._response_start_time is None:
1151
1151
            self._response_start_time = osutils.timer_func()
1152
 
        if suppress_time:
 
1152
        if include_time:
 
1153
            t = '%5.3fs ' % (time.clock() - self._response_start_time)
 
1154
        else:
1153
1155
            t = ''
1154
 
        else:
1155
 
            t = '%5.3fs ' % (time.clock() - self._response_start_time)
1156
1156
        if extra_bytes is None:
1157
1157
            extra = ''
1158
1158
        else:
1194
1194
        else:
1195
1195
            self._write_error_status()
1196
1196
        if 'hpss' in debug.debug_flags:
1197
 
            self._trace('response', repr(response.args), suppress_time=True)
 
1197
            self._trace('response', repr(response.args))
1198
1198
        self._write_structure(response.args)
1199
1199
        if response.body is not None:
1200
1200
            self._write_prefixed_body(response.body)
1201
1201
            if 'hpss' in debug.debug_flags:
1202
1202
                self._trace('body', '%d bytes' % (len(response.body),),
1203
 
                            response.body)
 
1203
                            response.body, include_time=True)
1204
1204
        elif response.body_stream is not None:
1205
1205
            count = num_bytes = 0
1206
1206
            first_chunk = None
1227
1227
                                    '%d bytes' % (len(chunk),),
1228
1228
                                    chunk, suppress_time=True)
1229
1229
            if 'hpss' in debug.debug_flags:
1230
 
                self._trace('body', '%d bytes %d chunks' % (num_bytes, count),
1231
 
                            response.body)
 
1230
                self._trace('body stream',
 
1231
                            '%d bytes %d chunks' % (num_bytes, count),
 
1232
                            first_chunk)
1232
1233
        self._write_end()
 
1234
        if 'hpss' in debug.debug_flags:
 
1235
            self._trace('response end', '', include_time=True)
1233
1236
 
1234
1237
 
1235
1238
def _iter_with_errors(iterable):