public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Raspl <raspl@linux.vnet.ibm.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com, frankja@linux.vnet.ibm.com
Subject: [PATCH v2 05/11] tools/kvm_stat: fix child trace events accounting
Date: Mon, 11 Dec 2017 12:25:23 +0100	[thread overview]
Message-ID: <20171211112529.33706-6-raspl@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171211112529.33706-1-raspl@linux.vnet.ibm.com>

From: Stefan Raspl <stefan.raspl@de.ibm.com>

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>
---
 tools/kvm/kvm_stat/kvm_stat     | 6 +++---
 tools/kvm/kvm_stat/kvm_stat.txt | 2 ++
 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):
             # 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]
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
 *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.
 
-- 
2.13.5

  parent reply	other threads:[~2017-12-11 11:25 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 11:25 [PATCH v2 00/11] tools/kvm_stat: misc fixes Stefan Raspl
2017-12-11 11:25 ` [PATCH v2 01/11] tools/kvm_stat: fix command line option '-g' Stefan Raspl
2017-12-11 11:25 ` [PATCH v2 02/11] tools/kvm_stat: fix drilldown in events-by-guests mode Stefan Raspl
2017-12-11 11:25 ` [PATCH v2 03/11] tools/kvm_stat: fix missing field update after filter change Stefan Raspl
2017-12-11 11:25 ` [PATCH v2 04/11] tools/kvm_stat: fix extra handling of 'help' with fields filter Stefan Raspl
2017-12-11 11:25 ` Stefan Raspl [this message]
2017-12-11 11:25 ` [PATCH v2 06/11] tools/kvm_stat: add hint on '-f help' to man page Stefan Raspl
2017-12-11 11:25 ` [PATCH v2 07/11] tools/kvm_stat: handle invalid regular expressions Stefan Raspl
2017-12-11 11:25 ` [PATCH v2 08/11] tools/kvm_stat: suppress usage information on command line errors Stefan Raspl
2017-12-12 15:53   ` Paolo Bonzini
2017-12-12 18:09     ` Stefan Raspl
2017-12-11 11:25 ` [PATCH v2 09/11] tools/kvm_stat: stop ignoring unhandled arguments Stefan Raspl
2017-12-12 15:56   ` Paolo Bonzini
2017-12-12 18:04     ` Stefan Raspl
2017-12-12 18:06       ` Paolo Bonzini
2017-12-11 11:25 ` [PATCH v2 10/11] tools/kvm_stat: sort '-f help' output Stefan Raspl
2017-12-11 12:20   ` Janosch Frank
2017-12-12 11:30     ` Stefan Raspl
2017-12-12 13:59     ` Stefan Raspl
2017-12-12 18:21     ` Stefan Raspl
2017-12-11 11:25 ` [PATCH v2 11/11] tools/kvm_stat: add line for totals Stefan Raspl
2017-12-12 16:00 ` [PATCH v2 00/11] tools/kvm_stat: misc fixes Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171211112529.33706-6-raspl@linux.vnet.ibm.com \
    --to=raspl@linux.vnet.ibm.com \
    --cc=frankja@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox