Rev 4892: Get rid of -Dhpssthread, just always include it. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-Dhpss-server

John Arbash Meinel john at arbash-meinel.com
Fri Dec 11 21:57:06 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1-Dhpss-server

------------------------------------------------------------
revno: 4892
revision-id: john at arbash-meinel.com-20091211215703-zxl1ygia6mlnvfyo
parent: john at arbash-meinel.com-20091211215144-ml4x175u6mwyhc13
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-Dhpss-server
timestamp: Fri 2009-12-11 15:57:03 -0600
message:
  Get rid of -Dhpssthread, just always include it.
  
  We might actually consider changing mutter() with a -Dlogthread sort of flag.
  As it could be useful to have all threads and pids get logged.
-------------- next part --------------
=== modified file 'bzrlib/help_topics/en/debug-flags.txt'
--- a/bzrlib/help_topics/en/debug-flags.txt	2009-12-11 21:51:44 +0000
+++ b/bzrlib/help_topics/en/debug-flags.txt	2009-12-11 21:57:03 +0000
@@ -19,7 +19,6 @@
 -Dhpss            Trace smart protocol requests and responses.
 -Dhpssdetail      More hpss details.
 -Dhpssvfs         Traceback on vfs access to Remote objects.
--Dhpssthread      Add thread identifiers to hpss debug messages
 -Dhttp            Trace http connections, requests and responses.
 -Dindex           Trace major index operations.
 -Dknit            Trace knit operations.

=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2009-12-11 21:51:44 +0000
+++ b/bzrlib/smart/medium.py	2009-12-11 21:57:03 +0000
@@ -300,12 +300,9 @@
         tstart = osutils.timer_func()
         osutils.send_all(self.socket, bytes, self._report_activity)
         if 'hpss' in debug.debug_flags:
-            if 'hpssthread' in debug.debug_flags:
-                ident_str = ' [%s] ' % (threading.currentThread().ident,)
-            else:
-                ident_str = ' '
-            trace.mutter('%12s:%s%d bytes to the socket in %.3fs'
-                         % ('wrote', ident_str, len(bytes),
+            thread_id = threading.currentThread().ident
+            trace.mutter('%12s: [%s] %d bytes to the socket in %.3fs'
+                         % ('wrote', thread_id, len(bytes),
                             osutils.timer_func() - tstart))
 
 

=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2009-12-11 21:51:44 +0000
+++ b/bzrlib/smart/protocol.py	2009-12-11 21:57:03 +0000
@@ -1153,18 +1153,14 @@
             t = ''
         else:
             t = '%5.3fs ' % (time.clock() - self._response_start_time)
-        if 'hpssthread' in debug.debug_flags:
-            t_info = ' [%s] ' % (self._thread_id,)
-        else:
-            t_info = ' '
         if extra_bytes is None:
             extra = ''
         else:
             extra = ' ' + repr(extra_bytes[:40])
             if len(extra) > 33:
                 extra = extra[:29] + extra[-1] + '...'
-        mutter('%12s:%s%s%s%s'
-               % (action, t_info, t, message, extra))
+        mutter('%12s: [%s] %s%s%s'
+               % (action, self._thread_id, t, message, extra))
 
     def send_error(self, exception):
         if self.response_sent:

=== modified file 'bzrlib/smart/request.py'
--- a/bzrlib/smart/request.py	2009-12-11 21:51:44 +0000
+++ b/bzrlib/smart/request.py	2009-12-11 21:57:03 +0000
@@ -294,22 +294,22 @@
             self._thread_id = threading.currentThread().ident
 
     def _trace(self, action, message, extra_bytes=None, suppress_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:
             t = ''
         else:
             t = '%5.3fs ' % (osutils.timer_func() - self._request_start_time)
-        if 'hpssthread' in debug.debug_flags:
-            t_info = ' [%s] ' % (self._thread_id,)
-        else:
-            t_info = ' '
         if extra_bytes is None:
             extra = ''
         else:
             extra = ' ' + repr(extra_bytes[:40])
             if len(extra) > 33:
                 extra = extra[:29] + extra[-1] + '...'
-        trace.mutter('%12s:%s%s%s%s'
-                     % (action, t_info, t, message, extra))
+        trace.mutter('%12s: [%s] %s%s%s'
+                     % (action, self._thread_id, t, message, extra))
 
     def accept_body(self, bytes):
         """Accept body data."""



More information about the bazaar-commits mailing list