From: Stefan Raspl Date: Thu, 22 Feb 2018 11:16:30 +0000 (+0100) Subject: tools/kvm_stat: print 'Total' line for multiple events only X-Git-Tag: Ubuntu-4.15.0-16.17~34 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=345e6e9b944413abf96a36a882a6f51b964ae3b9;p=mirror_ubuntu-bionic-kernel.git tools/kvm_stat: print 'Total' line for multiple events only BugLink: http://bugs.launchpad.net/bugs/1734130 The 'Total' line looks a bit weird when we have a single event only. This can happen e.g. due to filters. Therefore suppress when there's only a single event in the output. Signed-off-by: Stefan Raspl Signed-off-by: Paolo Bonzini (cherry picked from commit 6789af030a462708f937137e05eb12ea009fb348) Signed-off-by: Seth Forshee Acked-by: Thadeu Lima de Souza Cascardo Signed-off-by: Thadeu Lima de Souza Cascardo --- diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat index 862c997932e2..5898c22ba310 100755 --- a/tools/kvm/kvm_stat/kvm_stat +++ b/tools/kvm/kvm_stat/kvm_stat @@ -1206,7 +1206,7 @@ class Tui(object): row += 1 if row == 3: self.screen.addstr(4, 1, 'No matching events reported yet') - else: + if row > 4: tavg = int(round(tcur / sleeptime)) if tcur > 0 else '' self.screen.addstr(row, 1, '%-40s %10d %8s' % ('Total', total, tavg), curses.A_BOLD)