dom0: cpu load calculation when VM rebooted fix

This commit is contained in:
Marek Marczykowski 2011-06-11 20:44:26 +02:00
parent 7ced90832b
commit 454b678284

View File

@ -136,6 +136,9 @@ class QubesHost(object):
current[vm['domid']]['cpu_usage'] = \ current[vm['domid']]['cpu_usage'] = \
float(current[vm['domid']]['cpu_time'] - previous[vm['domid']]['cpu_time']) \ float(current[vm['domid']]['cpu_time'] - previous[vm['domid']]['cpu_time']) \
/ long(1000**3) / (current_time-previous_time) * 100 / long(1000**3) / (current_time-previous_time) * 100
if current[vm['domid']]['cpu_usage'] < 0:
# VM has been rebooted
current[vm['domid']]['cpu_usage'] = 0
else: else:
current[vm['domid']]['cpu_usage'] = 0 current[vm['domid']]['cpu_usage'] = 0