KVM Archive on lore.kernel.org
 help / color / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: linux-kernel@vger.kernel.org, KVM <kvm@vger.kernel.org>,
	Alexander Yarygin <yarygin@linux.vnet.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: [PULL 2/2] perf-kvm: fix of 'Min time' counting in report command
Date: Wed,  9 Apr 2014 16:21:59 +0200
Message-ID: <1397053319-2130-3-git-send-email-borntraeger@de.ibm.com> (raw)
In-Reply-To: <1397053319-2130-1-git-send-email-borntraeger@de.ibm.com>

From: Alexander Yarygin <yarygin@linux.vnet.ibm.com>

Every event in the perf-kvm has a 'stats' structure, which contains
max/min/average/etc times of handling this event.
The problem is that the 'perf-kvm stat report' command always shows
that 'min time' is 0us for every event. Example:

 # perf kvm stat report
Analyze events for all VCPUs:

    VM-EXIT    Samples  Samples%     Time%   Min Time   Max Time
    Avg time
[..]
0xB2 MSCH         12     0.07%     0.00%        0us        8us
    7.31us ( +-   2.11% )
0xB2 CHSC         12     0.07%     0.00%        0us       18us
    9.39us ( +-   9.49% )
0xB2 STPX          8     0.05%     0.00%        0us        2us
    1.88us ( +-   7.18% )
0xB2 STSI          7     0.04%     0.00%        0us       44us
    16.49us ( +-  38.20% )
[..]

This happens because 'stats' structure is not initialized and
stats->min equals to 0. Lets initialize the structure for every
event after it's allocation using init_stats() function. This initialize
stats->min to -1 and makes 'Min time' statistics counting work:

 # perf kvm stat report

Analyze events for all VCPUs:

    VM-EXIT    Samples  Samples%     Time%   Min Time   Max Time
    Avg time
[..]
0xB2 MSCH         12     0.07%     0.00%        6us        8us
    7.31us ( +-   2.11% )
0xB2 CHSC         12     0.07%     0.00%        7us       18us
    9.39us ( +-   9.49% )
0xB2 STPX          8     0.05%     0.00%        1us        2us
    1.88us ( +-   7.18% )
0xB2 STSI          7     0.04%     0.00%        1us       44us
    16.49us ( +-  38.20% )
[..]

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 tools/perf/builtin-kvm.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 21c164b..0f1e5a2 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -404,6 +404,7 @@ static struct kvm_event *kvm_alloc_init_event(struct event_key *key)
 	}
 
 	event->key = *key;
+	init_stats(&event->total.stats);
 	return event;
 }
 
-- 
1.7.9.5


  parent reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-09 14:21 [PULL 0/2] small perf fixes Christian Borntraeger
2014-04-09 14:21 ` [PULL 1/2] perf/tool: Fix usage of trace events with '-' in trace system name Christian Borntraeger
2014-04-16 13:00   ` Jiri Olsa
2014-04-16 13:28     ` Christian Borntraeger
2014-04-16 13:31       ` Christian Borntraeger
2014-04-16 13:39         ` Jiri Olsa
2014-04-09 14:21 ` Christian Borntraeger [this message]
2014-04-09 15:10   ` [PULL 2/2] perf-kvm: fix of 'Min time' counting in report command David Ahern
2014-04-15 13:05 ` [PULL 0/2] small perf fixes Christian Borntraeger
2014-04-15 13:17   ` Jiri Olsa

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=1397053319-2130-3-git-send-email-borntraeger@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=acme@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=yarygin@linux.vnet.ibm.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

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
		kvm@vger.kernel.org
	public-inbox-index kvm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.kvm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git