Rev 3200: Provide hpss debugging facilities. in http://people.ubuntu.com/~robertc/baz2.0/search-results

Robert Collins robertc at robertcollins.net
Fri Feb 1 06:52:19 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/search-results

------------------------------------------------------------
revno: 3200
revision-id:robertc at robertcollins.net-20080201065213-058c0unik3j3o9hb
parent: robertc at robertcollins.net-20080131034210-q1howitw0sny6yw5
committer: Robert Collins <robertc at robertcollins.net>
branch nick: hpss-get_parent_map debugging
timestamp: Fri 2008-02-01 17:52:13 +1100
message:
  Provide hpss debugging facilities.
modified:
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2008-01-31 03:42:10 +0000
+++ b/bzrlib/remote.py	2008-02-01 06:52:13 +0000
@@ -268,6 +268,8 @@
         self._leave_lock = False
         # A cache of looked up revision parent data; reset at unlock time.
         self._parents_map = None
+        if 'hpss' in debug.debug_flags:
+            self._requested_parents = None
         # For tests:
         # These depend on the actual remote format, so force them off for
         # maximum compatibility. XXX: In future these should depend on the
@@ -472,6 +474,8 @@
             self._lock_mode = 'r'
             self._lock_count = 1
             self._parents_map = {}
+            if 'hpss' in debug.debug_flags:
+                self._requested_parents = set()
             if self._real_repository is not None:
                 self._real_repository.lock_read()
         else:
@@ -510,6 +514,8 @@
             self._lock_mode = 'w'
             self._lock_count = 1
             self._parents_map = {}
+            if 'hpss' in debug.debug_flags:
+                self._requested_parents = set()
         elif self._lock_mode == 'r':
             raise errors.ReadOnlyError(self)
         else:
@@ -570,6 +576,8 @@
         if self._lock_count > 0:
             return
         self._parents_map = None
+        if 'hpss' in debug.debug_flags:
+            self._requested_parents = None
         old_mode = self._lock_mode
         self._lock_mode = None
         try:
@@ -772,7 +780,12 @@
                         len(set(self._parents_map).intersection(parent_map)),
                         len(parent_map))
             self._parents_map.update(parent_map)
-        return dict((k, ancestry[k]) for k in keys if k in ancestry)
+        present_keys = [k for k in keys if k in ancestry]
+        if 'hpss' in debug.debug_flags:
+            self._requested_parents.update(present_keys)
+            mutter('Current RemoteRepository graph hit rate: %d%%',
+                100.0 * len(self._requested_parents) / len(self._parents_map))
+        return dict((k, ancestry[k]) for k in present_keys)
 
     def _response_is_unknown_method(self, response, verb):
         """Return True if response is an unknonwn method response to verb.

=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2008-01-21 23:04:54 +0000
+++ b/bzrlib/smart/protocol.py	2008-02-01 06:52:13 +0000
@@ -488,6 +488,8 @@
                 mutter('                  (to %s)', self._request._medium._path)
             mutter('              %d bytes', len(body))
             self._request_start_time = time.time()
+            if 'hpssdetail' in debug.debug_flags:
+                mutter('hpss body content: %s', body)
         self._write_args(args)
         bytes = self._encode_bulk_data(body)
         self._request.accept_bytes(bytes)



More information about the bazaar-commits mailing list