projects
/
quix0rs-apt-p2p.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
ripped out xmlrpc, experimented with xmlrpc but with bencode, finally
[quix0rs-apt-p2p.git]
/
util.py
1
def bucket_stats(l):
2
"""given a list of khashmir instances, finds min, max, and average number of nodes in tables"""
3
max = avg = 0
4
min = None
5
def count(buckets):
6
c = 0
7
for bucket in buckets:
8
c = c + len(bucket.l)
9
return c
10
for node in l:
11
c = count(node.table.buckets)
12
if min == None:
13
min = c
14
elif c < min:
15
min = c
16
if c > max:
17
max = c
18
avg = avg + c
19
avg = avg / len(l)
20
return {'min':min, 'max':max, 'avg':avg}