From: Joerg Roedel <joerg.roedel@amd.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: <linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>,
Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 5/5] perf, tools: Do guest-only counting in perf-kvm by default
Date: Fri, 17 Jun 2011 15:37:34 +0200 [thread overview]
Message-ID: <1308317854-27398-6-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1308317854-27398-1-git-send-email-joerg.roedel@amd.com>
Make use of exclude_guest and exlude_host in perf-kvm to do
only guest-only counting by default.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
tools/perf/builtin-kvm.c | 3 ++-
tools/perf/util/event.c | 8 ++++++++
tools/perf/util/event.h | 2 ++
tools/perf/util/evlist.c | 5 ++++-
tools/perf/util/parse-events.c | 1 +
5 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 032324a..9b05afa 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -107,7 +107,8 @@ static int __cmd_buildid_list(int argc, const char **argv)
int cmd_kvm(int argc, const char **argv, const char *prefix __used)
{
- perf_host = perf_guest = 0;
+ perf_host = 0;
+ perf_guest = 1;
argc = parse_options(argc, argv, kvm_options, kvm_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 3c1b8a6..8262819 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -44,6 +44,14 @@ static struct perf_sample synth_sample = {
.period = 1,
};
+void event_attr_init(struct perf_event_attr *attr)
+{
+ if (!perf_host)
+ attr->exclude_host = 1;
+ if (!perf_guest)
+ attr->exclude_guest = 1;
+}
+
static pid_t perf_event__synthesize_comm(union perf_event *event, pid_t pid,
int full, perf_event__handler_t process,
struct perf_session *session)
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 1d7f664..376f67e 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -150,6 +150,8 @@ typedef int (*perf_event__handler_t)(union perf_event *event,
struct perf_sample *sample,
struct perf_session *session);
+void event_attr_init(struct perf_event_attr *attr);
+
int perf_event__synthesize_thread_map(struct thread_map *threads,
perf_event__handler_t process,
struct perf_session *session);
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index b021ea9..46d4ca7 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -82,8 +82,11 @@ int perf_evlist__add_default(struct perf_evlist *evlist)
.type = PERF_TYPE_HARDWARE,
.config = PERF_COUNT_HW_CPU_CYCLES,
};
- struct perf_evsel *evsel = perf_evsel__new(&attr, 0);
+ struct perf_evsel *evsel;
+
+ event_attr_init(&attr);
+ evsel = perf_evsel__new(&attr, 0);
if (evsel == NULL)
return -ENOMEM;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 8bfb8de..1c97b4b 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -842,6 +842,7 @@ int parse_events(const struct option *opt, const char *str, int unset __used)
for (;;) {
ostr = str;
memset(&attr, 0, sizeof(attr));
+ event_attr_init(&attr);
ret = parse_event_symbols(opt, &str, &attr);
if (ret == EVT_FAILED)
return -1;
--
1.7.4.1
next prev parent reply other threads:[~2011-06-17 13:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-17 13:37 [PATCH 0/5] perf support for amd guest/host-only bits v2 Joerg Roedel
2011-06-17 13:37 ` [PATCH 1/5] perf, core: Introduce attrs to count in either host or guest mode Joerg Roedel
2011-06-17 13:37 ` [PATCH 2/5] perf, amd: Use GO/HO bits in perf-ctr Joerg Roedel
2011-06-17 13:37 ` [PATCH 3/5] perf, tools: Add support for guest/host-only profiling Joerg Roedel
2011-06-17 13:37 ` [PATCH 4/5] perf, tools: Fix copy&paste error in perf-kvm option description Joerg Roedel
2011-06-17 13:37 ` Joerg Roedel [this message]
2011-06-19 9:01 ` [PATCH 0/5] perf support for amd guest/host-only bits v2 Avi Kivity
2011-06-28 16:10 ` Joerg Roedel
2011-06-29 9:02 ` Peter Zijlstra
2011-06-29 9:27 ` Avi Kivity
2011-06-29 9:48 ` Joerg Roedel
2011-06-29 9:36 ` Roedel, Joerg
2011-06-29 12:05 ` Paul Mackerras
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=1308317854-27398-6-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/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
all inboxes | Powered by JetHome®