aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStefan Raspl <stefan.raspl@de.ibm.com>2017-12-11 06:25:29 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2017-12-14 03:25:47 -0500
commitcf656c76614c6ec5b016233cac29738881c83c08 (patch)
tree2acd1b5b4409fd5e472c8dbad891b8344d7e5859 /tools
parent73fab6ffbd83795e38974bb438e7afce0242c61a (diff)
tools/kvm_stat: add line for totals
Add a line for the total number of events and current average at the bottom of the body. Note that both values exclude child trace events. I.e. if drilldown is activated via interactive command 'x', only the totals are accounted, or we'd be counting these twice (see previous commit "tools/kvm_stat: fix child trace events accounting"). Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/kvm/kvm_stat/kvm_stat9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index aa3bc47af1d0..566a70ddd005 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -1099,8 +1099,9 @@ class Tui(object):
1099 sortkey = sortCurAvg 1099 sortkey = sortCurAvg
1100 else: 1100 else:
1101 sortkey = sortTotal 1101 sortkey = sortTotal
1102 tavg = 0
1102 for key in sorted(stats.keys(), key=sortkey): 1103 for key in sorted(stats.keys(), key=sortkey):
1103 if row >= self.screen.getmaxyx()[0]: 1104 if row >= self.screen.getmaxyx()[0] - 1:
1104 break 1105 break
1105 values = stats[key] 1106 values = stats[key]
1106 if not values[0] and not values[1]: 1107 if not values[0] and not values[1]:
@@ -1112,9 +1113,15 @@ class Tui(object):
1112 self.screen.addstr(row, 1, '%-40s %10d%7.1f %8s' % 1113 self.screen.addstr(row, 1, '%-40s %10d%7.1f %8s' %
1113 (key, values[0], values[0] * 100 / total, 1114 (key, values[0], values[0] * 100 / total,
1114 cur)) 1115 cur))
1116 if cur is not '' and key.find('(') is -1:
1117 tavg += cur
1115 row += 1 1118 row += 1
1116 if row == 3: 1119 if row == 3:
1117 self.screen.addstr(4, 1, 'No matching events reported yet') 1120 self.screen.addstr(4, 1, 'No matching events reported yet')
1121 else:
1122 self.screen.addstr(row, 1, '%-40s %10d %8s' %
1123 ('Total', total, tavg if tavg else ''),
1124 curses.A_BOLD)
1118 self.screen.refresh() 1125 self.screen.refresh()
1119 1126
1120 def show_msg(self, text): 1127 def show_msg(self, text):