cleanup whitespace mess
This commit is contained in:
parent
b04d1ce005
commit
01bc257265
@ -35,10 +35,8 @@ def main():
|
||||
action="store_true", default=False,
|
||||
help="n m : One line summary of top n vms with more than m cpu_time %")
|
||||
|
||||
|
||||
(options, args) = parser.parse_args ()
|
||||
|
||||
|
||||
qvm_collection = QubesVmCollection()
|
||||
qvm_collection.lock_db_for_reading()
|
||||
qvm_collection.load()
|
||||
@ -47,9 +45,7 @@ def main():
|
||||
fields_to_display = ["name", "cpu", "mem"]
|
||||
|
||||
cpu_usages = None
|
||||
|
||||
qhost = QubesHost()
|
||||
|
||||
(measure_time, cpu_usages) = qhost.measure_cpu_usage(qvm_collection)
|
||||
|
||||
vms_list = [vm for vm in qvm_collection.values() if vm.is_running()]
|
||||
@ -62,25 +58,25 @@ def main():
|
||||
any_shown = False
|
||||
ndisp = 3
|
||||
cputh = 0
|
||||
if len(args) > 0:
|
||||
ndisp = int(args[0])
|
||||
if len(args) > 1:
|
||||
cputh = int(args[1])
|
||||
if len(args) > 0:
|
||||
ndisp = int(args[0])
|
||||
if len(args) > 1:
|
||||
cputh = int(args[1])
|
||||
|
||||
for vm in vms_to_display[:ndisp]:
|
||||
cpu = cpu_usages[vm.get_xid()]['cpu_usage']
|
||||
if cpu > cputh:
|
||||
any_shown = True
|
||||
sys.stdout.write("%d %s, " % (cpu, vm.name))
|
||||
sys.stdout.write("%d %s, " % (cpu, vm.name))
|
||||
|
||||
if any_shown:
|
||||
if any_shown:
|
||||
sys.stdout.write(" ... | ")
|
||||
|
||||
totalMem = 0
|
||||
dom0mem = 0
|
||||
for vm in vms_to_display:
|
||||
for vm in vms_to_display:
|
||||
if not vm.name == "dom0":
|
||||
totalMem += vm.get_mem()
|
||||
totalMem += vm.get_mem()
|
||||
else:
|
||||
dom0mem = vm.get_mem()
|
||||
totalMem /= 1024.0 * 1024.0
|
||||
|
Loading…
Reference in New Issue
Block a user