]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
tools/kvm_stat: fix child trace events accounting
authorStefan Raspl <stefan.raspl@de.ibm.com>
Mon, 11 Dec 2017 11:25:23 +0000 (12:25 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Dec 2017 08:25:44 +0000 (09:25 +0100)
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>
tools/kvm/kvm_stat/kvm_stat
tools/kvm/kvm_stat/kvm_stat.txt

index 4faf9f85a00e19c7f1e5f6ace6b1e94868a84976..90f0445d78085f9f2d85315dd543f3c5c282fe7e 100755 (executable)
@@ -1092,14 +1092,14 @@ class Tui(object):
             # sort by totals
             return (0, -stats[x][0])
         total = 0.
-        for val in stats.values():
-            total += val[0]
+        for key in stats.keys():
+            if key.find('(') is -1:
+                total += stats[key][0]
         if self._sorting == SORT_DEFAULT:
             sortkey = sortCurAvg
         else:
             sortkey = sortTotal
         for key in sorted(stats.keys(), key=sortkey):
-
             if row >= self.screen.getmaxyx()[0]:
                 break
             values = stats[key]
index e5cf836be8a1848bb82f39cfa3c7c75dcc67b4fa..75368a3c285fb97877ef196e8eeb38f04bb13848 100644 (file)
@@ -50,6 +50,8 @@ INTERACTIVE COMMANDS
 *s*::   set update interval
 
 *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.