public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>,
	David Ahern <dsahern@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Ingo Molnar <mingo@kernel.org>, Andi Kleen <andi@firstfloor.org>,
	William Cohen <wcohen@redhat.com>
Subject: [PATCH 3/6] perf stat: Change metrics context calculation
Date: Tue,  7 Apr 2015 23:25:16 +0200	[thread overview]
Message-ID: <1428441919-23099-4-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1428441919-23099-1-git-send-email-jolsa@kernel.org>

Changing metrics context calculation to allow more than
2 types of context.

Following patches will add support for the rest of the
exclude_* bits so we need separate array element for
all context combinations.

Link: http://lkml.kernel.org/n/tip-6mj0tn8z60ozof19xd80y6pe@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-stat.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 0b163ca4034f..0c748dda0692 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -247,9 +247,13 @@ out_free:
 	return -1;
 }
 
-#define NUM_CTX 3
+enum {
+	CTX_BIT_USER	= 1 << 0,
+	CTX_BIT_KERNEL	= 1 << 1,
+	CTX_BIT_MAX	= 1 << 2,
+};
 
-enum { CTX_USER, CTX_KERNEL, CTX_ALL };
+#define NUM_CTX CTX_BIT_MAX
 
 static struct stats runtime_nsecs_stats[MAX_NR_CPUS];
 static struct stats runtime_cycles_stats[NUM_CTX][MAX_NR_CPUS];
@@ -269,12 +273,13 @@ static struct stats runtime_elision_stats[NUM_CTX][MAX_NR_CPUS];
 
 static int evsel_context(struct perf_evsel *evsel)
 {
+	int ctx = 0;
+
 	if (evsel->attr.exclude_kernel)
-		return CTX_USER;
+		ctx |= CTX_BIT_KERNEL;
 	if (evsel->attr.exclude_user)
-		return CTX_KERNEL;
-	/* Handle hypervisor too? */
-	return CTX_ALL;
+		ctx |= CTX_BIT_USER;
+	return ctx;
 }
 
 static void perf_stat__reset_stats(struct perf_evlist *evlist)
-- 
1.9.3


  parent reply	other threads:[~2015-04-07 21:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 21:25 [RFC 0/6] perf stat: Metrics calculation fix Jiri Olsa
2015-04-07 21:25 ` [PATCH 1/6] perf tools: Add 'I' event modifier for exclude_idle bit Jiri Olsa
2015-04-08 12:56   ` Arnaldo Carvalho de Melo
2015-04-08 15:15   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-07 21:25 ` [PATCH 2/6] perf stat: Fix metrics calculation with event qualifiers Jiri Olsa
2015-04-08 13:28   ` Namhyung Kim
2015-04-23 22:15     ` Arnaldo Carvalho de Melo
2015-05-06  3:07   ` [tip:perf/core] " tip-bot for Andi Kleen
2015-04-07 21:25 ` Jiri Olsa [this message]
2015-05-06  3:08   ` [tip:perf/core] perf stat: Change metrics context calculation tip-bot for Jiri Olsa
2015-04-07 21:25 ` [PATCH 4/6] perf stat: Add metrics support for exclude_hv Jiri Olsa
2015-05-06  3:08   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-07 21:25 ` [PATCH 5/6] perf stat: Add metrics support for exclude_(host|guest) Jiri Olsa
2015-05-06  3:08   ` [tip:perf/core] perf stat: Add metrics support for exclude_( host|guest) tip-bot for Jiri Olsa
2015-04-07 21:25 ` [PATCH 6/6] perf stat: Add metrics support for exclude_idle Jiri Olsa
2015-05-06  3:08   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-07 21:30 ` [RFC 0/6] perf stat: Metrics calculation fix Jiri Olsa
2015-04-18 13:40 ` Jiri Olsa
2015-04-19  3:46 ` Namhyung Kim

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=1428441919-23099-4-git-send-email-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=wcohen@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