Rev 10: Include information about the depth of leaf nodes. in http://bazaar.launchpad.net/%7Ebzr/bzr-repodetails/trunk
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 2 01:45:22 GMT 2008
At http://bazaar.launchpad.net/%7Ebzr/bzr-repodetails/trunk
------------------------------------------------------------
revno: 10
revision-id: john at arbash-meinel.com-20081202014502-40sghjisv1lflwhb
parent: john at arbash-meinel.com-20081202014124-qgvuoydx8e2gzpch
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Mon 2008-12-01 19:45:02 -0600
message:
Include information about the depth of leaf nodes.
-------------- next part --------------
=== modified file 'gather_stats.py'
--- a/gather_stats.py 2008-11-19 20:55:29 +0000
+++ b/gather_stats.py 2008-12-02 01:45:02 +0000
@@ -192,9 +192,11 @@
def _gather_chk_map(objectstats, chk_bytes, pending, internal_counter,
- leaf_counter):
+ leaf_counter, depth_counter):
done = set()
+ depth = 0
while pending:
+ depth += 1
# Don't visit nodes twice
done.update(pending)
next = pending
@@ -208,6 +210,7 @@
else:
items = list(node.iteritems(chk_bytes))
objectstats.add_extra_counter(leaf_counter, len(items))
+ objectstats.add_extra_counter(depth_counter, depth)
# Different routes can take a different number of steps to get to the
# same nodes.
pending.difference_update(done)
@@ -222,11 +225,10 @@
pending.add(inv.id_to_entry._root_node)
if inv.parent_id_basename_to_file_id is not None:
pending_parent_id.add(inv.parent_id_basename_to_file_id._root_node)
- _gather_chk_map(objectstats, repo.chk_bytes, pending, 'internal node refs',
- 'leaf node items')
+ _gather_chk_map(objectstats, repo.chk_bytes, pending,
+ 'internal node refs', 'leaf node items', 'inv depth')
_gather_chk_map(objectstats, repo.chk_bytes, pending_parent_id,
- 'internal parent_id refs',
- 'leaf parent_id items')
+ 'internal p_id refs', 'leaf p_id items', 'p_id depth')
def _gather_stats_locked(repo):
=== modified file 'tests/test_repositorydetails.py'
--- a/tests/test_repositorydetails.py 2008-11-19 20:55:29 +0000
+++ b/tests/test_repositorydetails.py 2008-12-02 01:45:02 +0000
@@ -59,8 +59,10 @@
"Total: 0 KiB 100% 0 KiB 100% 5\n"
"\n"
"Extra Info: count total avg stddev min max\n"
+ "inv depth 1 1 1 0.0 1 1\n"
"leaf node items 1 2 2 0.0 2 2\n"
- "leaf parent_id items 1 2 2 0.0 2 2\n"
+ "leaf p_id items 1 2 2 0.0 2 2\n"
+ "p_id depth 1 1 1 0.0 1 1\n"
, out)
self.assertEqual("", err)
@@ -104,7 +106,9 @@
self.assertEqual(370, stats.inventories.raw_size)
self.assertEqual(518, stats.inventories.compressed_size)
self.assertEqual({'leaf node items': [1, 2, 4, 2, 2],
- 'leaf parent_id items': [1, 2, 4, 2, 2]},
+ 'leaf p_id items': [1, 2, 4, 2, 2],
+ 'p_id depth': [1, 1, 1, 1, 1],
+ 'inv depth': [1, 1, 1, 1, 1]},
stats.inventories.extra_counters)
self.assertEqual(1, stats.texts.objects)
self.assertEqual(16, stats.texts.raw_size)
More information about the bazaar-commits
mailing list