mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf target: Add cpu flag to sample_type if target has cpu
@ 2012-05-21  1:42 Namhyung Kim
  2012-05-23 15:24 ` [tip:perf/core] " tip-bot for Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2012-05-21  1:42 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML

Add PERF_SAMPLE_CPU flag into attr->sample_type if an user
specified any of cpu target (either system-wide or cpu list).
It will show correct values when cpu sort key is given for
perf top and perf report.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
 tools/perf/builtin-top.c |    3 +++
 tools/perf/util/evsel.c  |    2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ebcd15883ab8..8e3cf429dd18 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -900,6 +900,9 @@ static void perf_top__start_counters(struct perf_top *top)
 			attr->read_format |= PERF_FORMAT_ID;
 		}
 
+		if (perf_target__has_cpu(&top->target))
+			attr->sample_type |= PERF_SAMPLE_CPU;
+
 		if (symbol_conf.use_callchain)
 			attr->sample_type |= PERF_SAMPLE_CALLCHAIN;
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d7a2b4b9801d..d26b8fe0abd1 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -107,7 +107,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts,
 	if (opts->call_graph)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
-	if (opts->target.system_wide)
+	if (perf_target__has_cpu(&opts->target))
 		attr->sample_type	|= PERF_SAMPLE_CPU;
 
 	if (opts->period)
-- 
1.7.10.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:perf/core] perf target: Add cpu flag to sample_type if target has cpu
  2012-05-21  1:42 [PATCH] perf target: Add cpu flag to sample_type if target has cpu Namhyung Kim
@ 2012-05-23 15:24 ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-05-23 15:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, mingo, hpa, mingo, a.p.zijlstra,
	namhyung.kim, namhyung, tglx

Commit-ID:  e40ee742d4542b4c046ac5426654b1494d87ad73
Gitweb:     http://git.kernel.org/tip/e40ee742d4542b4c046ac5426654b1494d87ad73
Author:     Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Mon, 21 May 2012 10:42:07 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 22 May 2012 12:37:12 -0300

perf target: Add cpu flag to sample_type if target has cpu

Add PERF_SAMPLE_CPU flag into attr->sample_type if an user specified any
of cpu target (either system-wide or cpu list).

It will show correct values when cpu sort key is given for perf top and
perf report.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1337564527-9367-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |    3 +++
 tools/perf/util/evsel.c  |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 3e981a7..18bd226 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -900,6 +900,9 @@ static void perf_top__start_counters(struct perf_top *top)
 			attr->read_format |= PERF_FORMAT_ID;
 		}
 
+		if (perf_target__has_cpu(&top->target))
+			attr->sample_type |= PERF_SAMPLE_CPU;
+
 		if (symbol_conf.use_callchain)
 			attr->sample_type |= PERF_SAMPLE_CALLCHAIN;
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f4f427c..9abd8ac 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -108,7 +108,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts,
 	if (opts->call_graph)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
-	if (opts->target.system_wide)
+	if (perf_target__has_cpu(&opts->target))
 		attr->sample_type	|= PERF_SAMPLE_CPU;
 
 	if (opts->period)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-23 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21  1:42 [PATCH] perf target: Add cpu flag to sample_type if target has cpu Namhyung Kim
2012-05-23 15:24 ` [tip:perf/core] " tip-bot for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome