Hi: Sometimes the output of kvm_stat is blank and not friendly enough. This patch is used to fix this problem Before: kvm statistics - summary Event Total %Total CurAvg/s ... kvm_apic_ipi 1 0.2 5 kvm_emulate_insn 27 4.8 kvm_ioapic_set_irq 9 1.6 kvm_pic_set_irq 9 1.6 kvm_set_irq 9 1.6 Total 30216 1986 After kvm statistics - summary Event Total %Total CurAvg/s ... kvm_apic_ipi 1 0.2 5 kvm_emulate_insn 27 4.8 0 kvm_ioapic_set_irq 9 1.6 0 kvm_pic_set_irq 9 1.6 0 kvm_set_irq 9 1.6 0 Total 30216 1986 Patch: --- a/tools/kvm/kvm_stat/kvm_stat +++ b/tools/kvm/kvm_stat/kvm_stat @@ -1191,7 +1191,7 @@ class Tui(object): key = self.get_gname_from_pid(key) if not key: continue - cur = int(round(values.delta / sleeptime)) if values.delta else '' + cur = int(round(values.delta / sleeptime)) if values.delta else 0 if key[0] != ' ': if values.delta: tcur += values.delta @@ -1206,7 +1206,7 @@ class Tui(object): if row == 3: self.screen.addstr(4, 1, 'No matching events reported yet') if row > 4: - tavg = int(round(tcur / sleeptime)) if tcur > 0 else '' + tavg = int(round(tcur / sleeptime)) if tcur > 0 else 0 self.screen.addstr(row, 1, '%-40s %10d %8s' % ('Total', total, tavg), curses.A_BOLD) self.screen.refresh()