diff options
author | Martin Schwenke <martin@meltin.net> | 2011-07-22 20:20:05 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2011-07-29 14:32:07 +1000 |
commit | c84310e5127574071897a53830385ffbcded6221 (patch) | |
tree | ec9ab59b23209b50f4c5a4c6ecd4aa18340b9b14 /ctdb/tests/takeover | |
parent | 9f8a781ff1bea7983fa2045b9c3621f215aa14d8 (diff) | |
download | samba-c84310e5127574071897a53830385ffbcded6221.tar.gz |
IP allocation simulation - add mean imbalance statistics.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit b541194d6075e5db72fb691fb79dc81659771cb1)
Diffstat (limited to 'ctdb/tests/takeover')
-rwxr-xr-x | ctdb/tests/takeover/ctdb_takeover.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ctdb/tests/takeover/ctdb_takeover.py b/ctdb/tests/takeover/ctdb_takeover.py index 0f840b1ae75..5abfc29bd09 100755 --- a/ctdb/tests/takeover/ctdb_takeover.py +++ b/ctdb/tests/takeover/ctdb_takeover.py @@ -192,6 +192,8 @@ def imbalance_metric(ips): else: return 0 +def mean(l): + return float(sum(l))/len(l) class Node(object): def __init__(self, public_addresses): @@ -275,6 +277,9 @@ class Cluster(object): print "Max imbalance: %6d" % max(self.imbalance) if self.have_ip_groups(): print "Max group imbalance counts: ", map(max, zip(*self.imbalance_groups)) + print "Mean imbalance: %f" % mean(self.imbalance) + if self.have_ip_groups(): + print "Mean group imbalances counts: ", map(mean, zip(*self.imbalance_groups)) print "Final imbalance: %6d" % self.imbalance[-1] if self.have_ip_groups(): print "Final group imbalances: ", self.imbalance_groups[-1] |