From 87d1e973c7e82001fb09a1ab6254780fd2104ab9 Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Thu, 9 Sep 2010 10:29:35 +0200 Subject: [PATCH] qmemman: print balance stats only when updating --- dom0/qmemman/qmemman.py | 7 +++++++ dom0/qmemman/qmemman_algo.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dom0/qmemman/qmemman.py b/dom0/qmemman/qmemman.py index d0cb14ff..aca537d3 100755 --- a/dom0/qmemman/qmemman.py +++ b/dom0/qmemman/qmemman.py @@ -139,6 +139,12 @@ class SystemState: total_memory_transfer += abs(memory_change) return total_memory_transfer > MIN_TOTAL_MEMORY_TRANSFER + def print_stats(self, xenfree, memset_reqs): + for i in self.domdict.keys(): + if self.domdict[i].meminfo is not None: + print 'dom' , i, 'act/pref', self.domdict[i].memory_actual, qmemman_algo.prefmem(self.domdict[i]) + print 'xenfree=', xenfree, 'balance req:', memset_reqs + def do_balance(self): if os.path.isfile('/var/run/qubes/do-not-membalance'): return @@ -148,6 +154,7 @@ class SystemState: if not self.is_balance_req_significant(memset_reqs): return + self.print_stats(xenfree, memset_reqs) wait_before_first_inflate = False i = 0 while i < len(memset_reqs): diff --git a/dom0/qmemman/qmemman_algo.py b/dom0/qmemman/qmemman_algo.py index 61e58b68..b0c9cd1e 100755 --- a/dom0/qmemman/qmemman_algo.py +++ b/dom0/qmemman/qmemman_algo.py @@ -82,7 +82,7 @@ def balance_when_enough_memory(domdict, xenfree, total_mem_pref, totalsum): donors_rq.append((i, target)) else: acceptors_rq.append((i, target)) - print 'balance(enough): xenfree=', xenfree, 'requests:', donors_rq + acceptors_rq +# print 'balance(enough): xenfree=', xenfree, 'requests:', donors_rq + acceptors_rq return donors_rq + acceptors_rq #when not enough mem to make everyone be above prefmem, make donors be at prefmem, and @@ -102,7 +102,7 @@ def balance_when_low_on_memory(domdict, xenfree, total_mem_pref_acceptors, donor scale = 1.0*prefmem(domdict[i])/total_mem_pref_acceptors target_nonint = domdict[i].memory_actual + scale*squeezed_mem acceptors_rq.append((i, int(target_nonint))) - print 'balance(low): xenfree=', xenfree, 'requests:', donors_rq + acceptors_rq +# print 'balance(low): xenfree=', xenfree, 'requests:', donors_rq + acceptors_rq return donors_rq + acceptors_rq def balance(xenfree, domdict): @@ -118,7 +118,7 @@ def balance(xenfree, domdict): if domdict[i].meminfo is None: continue need = memneeded(domdict[i]) - print 'domain' , i, 'act/pref', domdict[i].memory_actual, prefmem(domdict[i]), 'need=', need +# print 'domain' , i, 'act/pref', domdict[i].memory_actual, prefmem(domdict[i]), 'need=', need if need < 0: donors.append(i) else: