qmemman: print balance stats only when updating

This commit is contained in:
Rafal Wojtczuk 2010-09-09 10:29:35 +02:00
parent 5be12f8459
commit 87d1e973c7
2 changed files with 10 additions and 3 deletions

View File

@ -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):

View File

@ -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: