lkml.org 
[lkml]   [2009]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/2] perf_counter: tools: Make :u and :k exclude hypervisor
At present, appending ":u" to an event sets the exclude_kernel bit,
and ":k" sets the exclude_user bit. There is no way to set the
exclude_hv bit, which means that on systems with a hypervisor (e.g.
IBM pSeries systems), we get counts from hypervisor mode for an event
such as 0:1:u.

This fixes the problem by setting all three exclude bits when we see
the second ':' and the clearing the exclude bits corresponding to the
modes we want to count. This also adds a ":h" modifier to allow the
user to ask for counts in hypervisor mode.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
tools/perf/util/parse-events.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4d042f1..f2ffe2c 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -277,10 +277,15 @@ static int parse_event_symbols(const char *str, struct perf_counter_attr *attr)
sep = strchr(pstr, ':');
if (sep) {
pstr = sep + 1;
+ attr->exclude_user = 1;
+ attr->exclude_kernel = 1;
+ attr->exclude_hv = 1;
if (strchr(pstr, 'k'))
- attr->exclude_user = 1;
+ attr->exclude_kernel = 0;
if (strchr(pstr, 'u'))
- attr->exclude_kernel = 1;
+ attr->exclude_user = 0;
+ if (strchr(pstr, 'h'))
+ attr->exclude_hv = 0;
}
attr->type = type;
attr->config = id;
--
1.6.0.4


\
 
 \ /
  Last update: 2009-06-29 13:17    [W:0.039 / U:5.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site