aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStefan Raspl <stefan.raspl@de.ibm.com>2017-12-11 06:25:23 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2017-12-14 03:25:44 -0500
commitfff8c9eb48aa58259071b5df0e6d4c1c0bc1ba51 (patch)
tree019cb2507b30b417d9b50dfa3a21aa0547cee834 /tools
parentb74faa930deb2e37ed5caa0abfc687c8c532e946 (diff)
tools/kvm_stat: fix child trace events accounting
Child trace events were included in calculation of the overall total, which is used for calculation of the percentages of the '%Total' column. However, the parent trace envents' stats summarize the child trace events, hence we'd incorrectly account for them twice, leading to slightly wrong stats. With this fix, we use the correct total. Consequently, the sum of the child trace events' '%Total' column values is identical to the respective value of the respective parent event. However, this also means that the sum of the '%Total' column values will aggregate to more than 100 percent. 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_stat6
-rw-r--r--tools/kvm/kvm_stat/kvm_stat.txt2
2 files changed, 5 insertions, 3 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 4faf9f85a00e..90f0445d7808 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -1092,14 +1092,14 @@ class Tui(object):
1092 # sort by totals 1092 # sort by totals
1093 return (0, -stats[x][0]) 1093 return (0, -stats[x][0])
1094 total = 0. 1094 total = 0.
1095 for val in stats.values(): 1095 for key in stats.keys():
1096 total += val[0] 1096 if key.find('(') is -1:
1097 total += stats[key][0]
1097 if self._sorting == SORT_DEFAULT: 1098 if self._sorting == SORT_DEFAULT:
1098 sortkey = sortCurAvg 1099 sortkey = sortCurAvg
1099 else: 1100 else:
1100 sortkey = sortTotal 1101 sortkey = sortTotal
1101 for key in sorted(stats.keys(), key=sortkey): 1102 for key in sorted(stats.keys(), key=sortkey):
1102
1103 if row >= self.screen.getmaxyx()[0]: 1103 if row >= self.screen.getmaxyx()[0]:
1104 break 1104 break
1105 values = stats[key] 1105 values = stats[key]
diff --git a/tools/kvm/kvm_stat/kvm_stat.txt b/tools/kvm/kvm_stat/kvm_stat.txt
index e5cf836be8a1..75368a3c285f 100644
--- a/tools/kvm/kvm_stat/kvm_stat.txt
+++ b/tools/kvm/kvm_stat/kvm_stat.txt
@@ -50,6 +50,8 @@ INTERACTIVE COMMANDS
50*s*:: set update interval 50*s*:: set update interval
51 51
52*x*:: toggle reporting of stats for child trace events 52*x*:: toggle reporting of stats for child trace events
53 :: *Note*: The stats for the parents summarize the respective child trace
54 events
53 55
54Press any other key to refresh statistics immediately. 56Press any other key to refresh statistics immediately.
55 57