Commit fff8c9eb authored by Stefan Raspl's avatar Stefan Raspl Committed by Paolo Bonzini

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: default avatarStefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b74faa93
...@@ -1092,14 +1092,14 @@ class Tui(object): ...@@ -1092,14 +1092,14 @@ class Tui(object):
# sort by totals # sort by totals
return (0, -stats[x][0]) return (0, -stats[x][0])
total = 0. total = 0.
for val in stats.values(): for key in stats.keys():
total += val[0] if key.find('(') is -1:
total += stats[key][0]
if self._sorting == SORT_DEFAULT: if self._sorting == SORT_DEFAULT:
sortkey = sortCurAvg sortkey = sortCurAvg
else: else:
sortkey = sortTotal sortkey = sortTotal
for key in sorted(stats.keys(), key=sortkey): for key in sorted(stats.keys(), key=sortkey):
if row >= self.screen.getmaxyx()[0]: if row >= self.screen.getmaxyx()[0]:
break break
values = stats[key] values = stats[key]
......
...@@ -50,6 +50,8 @@ INTERACTIVE COMMANDS ...@@ -50,6 +50,8 @@ INTERACTIVE COMMANDS
*s*:: set update interval *s*:: set update interval
*x*:: toggle reporting of stats for child trace events *x*:: toggle reporting of stats for child trace events
:: *Note*: The stats for the parents summarize the respective child trace
events
Press any other key to refresh statistics immediately. Press any other key to refresh statistics immediately.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment