Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/kvm_stat: add '%Total' column

Add column '%Total' next to 'Total' for easier comparison of numbers between
hosts.

Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>

authored by

Stefan Raspl and committed by
Paolo Bonzini
e55fe3cc 9f114a03

+8 -1
+8 -1
tools/kvm/kvm_stat/kvm_stat
··· 973 973 self.screen.addstr(2, 1, 'Event') 974 974 self.screen.addstr(2, 1 + LABEL_WIDTH + NUMBER_WIDTH - 975 975 len('Total'), 'Total') 976 - self.screen.addstr(2, 1 + LABEL_WIDTH + NUMBER_WIDTH + 8 - 976 + self.screen.addstr(2, 1 + LABEL_WIDTH + NUMBER_WIDTH + 7 - 977 + len('%Total'), '%Total') 978 + self.screen.addstr(2, 1 + LABEL_WIDTH + NUMBER_WIDTH + 7 + 8 - 977 979 len('Current'), 'Current') 978 980 self.screen.addstr(4, 1, 'Collecting data...') 979 981 self.screen.refresh() ··· 991 989 return (-stats[x][1], -stats[x][0]) 992 990 else: 993 991 return (0, -stats[x][0]) 992 + total = 0. 993 + for val in stats.values(): 994 + total += val[0] 994 995 for key in sorted(stats.keys(), key=sortkey): 995 996 996 997 if row >= self.screen.getmaxyx()[0]: ··· 1006 1001 col += LABEL_WIDTH 1007 1002 self.screen.addstr(row, col, '%10d' % (values[0],)) 1008 1003 col += NUMBER_WIDTH 1004 + self.screen.addstr(row, col, '%7.1f' % (values[0] * 100 / total,)) 1005 + col += 7 1009 1006 if values[1] is not None: 1010 1007 self.screen.addstr(row, col, '%8d' % (values[1] / sleeptime,)) 1011 1008 row += 1