Rev 4349: (jml) Show number of VFS calls when using -Dhpss. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon May 11 06:35:23 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4349
revision-id: pqm at pqm.ubuntu.com-20090511052540-r3l0iwm1uo716iv0
parent: pqm at pqm.ubuntu.com-20090511023821-wzybcm1ga7ef1mq5
parent: jml at canonical.com-20090511043327-43p8twenbmh804f8
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-05-11 06:25:40 +0100
message:
  (jml) Show number of VFS calls when using -Dhpss.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
    ------------------------------------------------------------
    revno: 4326.2.4
    revision-id: jml at canonical.com-20090511043327-43p8twenbmh804f8
    parent: jml at canonical.com-20090505221141-dzboirew1a9dcqbc
    parent: pqm at pqm.ubuntu.com-20090508195148-cw1mw95i0qo39ggg
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: report-vfs-calls
    timestamp: Mon 2009-05-11 14:33:27 +1000
    message:
      Merge trunk, resolving conflicts.
    added:
      bzrlib/tests/per_interbranch/test_pull.py test_pull.py-20090227164435-0rtbqqyuh1rmm82n-1
      bzrlib/tests/per_interbranch/test_push.py test_push.py-20090330192649-pca31sb2ubbtcs15-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/branchbuilder.py        branchbuilder.py-20070427022007-zlxpqz2lannhk6y8-1
      bzrlib/btree_index.py          index.py-20080624222253-p0x5f92uyh5hw734-7
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/filters/eol.py          eol.py-20090327060429-todzdjmqt3bpv5r8-1
      bzrlib/hashcache.py            hashcache.py-20050706091756-fe3a8cc1143ff24f
      bzrlib/lock.py                 lock.py-20050527050856-ec090bb51bc03349
      bzrlib/lockdir.py              lockdir.py-20060220222025-98258adf27fbdda3
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
      bzrlib/rules.py                properties.py-20080506032617-9k06uqalkf09ck0z-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/switch.py               switch.py-20071116011000-v5lnw7d2wkng9eux-1
      bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_bound_branches.py test_bound_branches.py-20051109215527-2373188ad566c205
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_logformats.py test_logformats.py-20060216104208-ba5a16c83480b7e4
      bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
      bzrlib/tests/blackbox/test_pull.py test_pull.py-20051201144907-64959364f629947f
      bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
      bzrlib/tests/blackbox/test_reconfigure.py test_reconfigure.py-20070908173426-khfo5fi2rgzgtwj3-1
      bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
      bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
      bzrlib/tests/per_interbranch/__init__.py __init__.py-20090225010018-l7w4uvvt73ea2vj9-1
      bzrlib/tests/per_interbranch/test_update_revisions.py test_update_revision-20090225011043-7u1jnapdeuj07rre-1
      bzrlib/tests/per_repository/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
      bzrlib/tests/per_repository/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
      bzrlib/tests/test__dirstate_helpers.py test_dirstate_helper-20070504035751-jsbn00xodv0y1eve-2
      bzrlib/tests/test_branchbuilder.py test_branchbuilder.p-20070427022007-zlxpqz2lannhk6y8-2
      bzrlib/tests/test_bundle.py    test.py-20050630184834-092aa401ab9f039c
      bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
      bzrlib/tests/test_eol_filters.py test_eol_filters.py-20090327060429-todzdjmqt3bpv5r8-2
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_lockdir.py   test_lockdir.py-20060220222025-33d4221569a3d600
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_rename_map.py test_rename_map.py-20090312140439-xexkkmjlg2enbohc-2
      bzrlib/tests/test_shelf.py     test_prepare_shelf.p-20081005181341-n74qe6gu1e65ad4v-2
      bzrlib/tests/test_switch.py    test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
      bzrlib/tests/test_tag.py       test_tag.py-20070212110532-91cw79inah2cfozx-2
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/tree_implementations/test_get_symlink_target.py test_get_symlink_tar-20070225165554-ickod3w3t7u0zzqh-1
      bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 4326.2.3
    revision-id: jml at canonical.com-20090505221141-dzboirew1a9dcqbc
    parent: jml at canonical.com-20090505121226-p1ex3sg47r80amt9
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: report-vfs-calls
    timestamp: Wed 2009-05-06 08:11:41 +1000
    message:
      Use as a dict.
    modified:
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
    ------------------------------------------------------------
    revno: 4326.2.2
    revision-id: jml at canonical.com-20090505121226-p1ex3sg47r80amt9
    parent: jml at canonical.com-20090505120900-j3no3vq745fcyn1y
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: report-vfs-calls
    timestamp: Tue 2009-05-05 22:12:26 +1000
    message:
      Don't forget to update NEWS!
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 4326.2.1
    revision-id: jml at canonical.com-20090505120900-j3no3vq745fcyn1y
    parent: pqm at pqm.ubuntu.com-20090504221201-uh3mfp83o2m0ts7n
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: report-vfs-calls
    timestamp: Tue 2009-05-05 22:09:00 +1000
    message:
      Show the number of VFS calls in -Dhpss output.
    modified:
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
=== modified file 'NEWS'
--- a/NEWS	2009-05-08 17:29:33 +0000
+++ b/NEWS	2009-05-11 04:33:27 +0000
@@ -32,6 +32,9 @@
 Improvements
 ************
 
+* -Dhpss output now includes the number of VFS calls made to the remote
+  server. (Jonathan Lange)
+
 * ``--coverage`` works for code running in threads too.
   (Andrew Bennets, Vincent Ladeuil)
 

=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2009-04-04 02:50:01 +0000
+++ b/bzrlib/smart/medium.py	2009-05-05 22:11:41 +0000
@@ -43,7 +43,7 @@
     ui,
     urlutils,
     )
-from bzrlib.smart import client, protocol
+from bzrlib.smart import client, protocol, request, vfs
 from bzrlib.transport import ssh
 """)
 
@@ -509,7 +509,8 @@
         """
         medium_repr = repr(medium)
         # Add this medium to the WeakKeyDictionary
-        self.counts[medium] = [0, medium_repr]
+        self.counts[medium] = dict(count=0, vfs_count=0,
+                                   medium_repr=medium_repr)
         # Weakref callbacks are fired in reverse order of their association
         # with the referenced object.  So we add a weakref *after* adding to
         # the WeakKeyDict so that we can report the value from it before the
@@ -519,17 +520,23 @@
     def increment_call_count(self, params):
         # Increment the count in the WeakKeyDictionary
         value = self.counts[params.medium]
-        value[0] += 1
+        value['count'] += 1
+        request_method = request.request_handlers.get(params.method)
+        if issubclass(request_method, vfs.VfsRequest):
+            value['vfs_count'] += 1
 
     def done(self, ref):
         value = self.counts[ref]
-        count, medium_repr = value
+        count, vfs_count, medium_repr = (
+            value['count'], value['vfs_count'], value['medium_repr'])
         # In case this callback is invoked for the same ref twice (by the
         # weakref callback and by the atexit function), set the call count back
         # to 0 so this item won't be reported twice.
-        value[0] = 0
+        value['count'] = 0
+        value['vfs_count'] = 0
         if count != 0:
-            trace.note('HPSS calls: %d %s', count, medium_repr)
+            trace.note('HPSS calls: %d (%d vfs) %s',
+                       count, vfs_count, medium_repr)
 
     def flush_all(self):
         for ref in list(self.counts.keys()):




More information about the bazaar-commits mailing list