public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf stat: Clear sample_(type|period) for counting
@ 2015-11-25 15:36 Jiri Olsa
  2015-11-25 15:36 ` [PATCH 2/2] perf evlist: Display WEIGHT sample type bit Jiri Olsa
  2015-11-27  7:46 ` [tip:perf/core] perf stat: Clear sample_(type|period) for counting tip-bot for Jiri Olsa
  0 siblings, 2 replies; 5+ messages in thread
From: Jiri Olsa @ 2015-11-25 15:36 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Clear sample_(type|period) for counting, as it only confuses
debug output with unwanted sampling details:

Before:
  $ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
  ------------------------------------------------------------
  perf_event_attr:
    type                             2
    size                             112
    config                           0x11
    { sample_period, sample_freq }   1
    sample_type                      TIME|CPU|PERIOD|RAW
    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
    disabled                         1
    inherit                          1
    enable_on_exec                   1
    exclude_guest                    1
  ...

After:
  $ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
  ------------------------------------------------------------
  perf_event_attr:
    type                             2
    size                             112
    config                           0x11
    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
    disabled                         1
    inherit                          1
    enable_on_exec                   1
    exclude_guest                    1
  ...

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

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e77880b5094d..df2fbf046ee2 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -161,6 +161,13 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 
 	attr->inherit = !no_inherit;
 
+	/*
+	 * Some events get initialized with sample_(period/type) set,
+	 * like tracepoints. Clear it up for counting.
+	 */
+	attr->sample_period = 0;
+	attr->sample_type   = 0;
+
 	if (target__has_cpu(&target))
 		return perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel));
 
-- 
2.4.3


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

* [PATCH 2/2] perf evlist: Display WEIGHT sample type bit
  2015-11-25 15:36 [PATCH 1/2] perf stat: Clear sample_(type|period) for counting Jiri Olsa
@ 2015-11-25 15:36 ` Jiri Olsa
  2015-11-26 19:54   ` Arnaldo Carvalho de Melo
  2015-11-27  7:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2015-11-27  7:46 ` [tip:perf/core] perf stat: Clear sample_(type|period) for counting tip-bot for Jiri Olsa
  1 sibling, 2 replies; 5+ messages in thread
From: Jiri Olsa @ 2015-11-25 15:36 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Adding WIEGHT bit_name call to display sample_type properly.

  $ perf evlist -v
  cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|ID|CPU|DATA_SRC|WEIGHT ...

Link: http://lkml.kernel.org/n/tip-iql3yeqtpnzv7qeptgv8wuaw@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/evsel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 397fb4ed3c97..0a1f4d9e52fc 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1192,6 +1192,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
 		bit_name(PERIOD), bit_name(STREAM_ID), bit_name(RAW),
 		bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
 		bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC),
+		bit_name(WEIGHT),
 		{ .name = NULL, }
 	};
 #undef bit_name
-- 
2.4.3


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

* Re: [PATCH 2/2] perf evlist: Display WEIGHT sample type bit
  2015-11-25 15:36 ` [PATCH 2/2] perf evlist: Display WEIGHT sample type bit Jiri Olsa
@ 2015-11-26 19:54   ` Arnaldo Carvalho de Melo
  2015-11-27  7:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
  1 sibling, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-26 19:54 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Em Wed, Nov 25, 2015 at 04:36:55PM +0100, Jiri Olsa escreveu:
> Adding WIEGHT bit_name call to display sample_type properly.

Thanks, applied both.

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

* [tip:perf/core] perf stat: Clear sample_(type|period) for counting
  2015-11-25 15:36 [PATCH 1/2] perf stat: Clear sample_(type|period) for counting Jiri Olsa
  2015-11-25 15:36 ` [PATCH 2/2] perf evlist: Display WEIGHT sample type bit Jiri Olsa
@ 2015-11-27  7:46 ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-11-27  7:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: a.p.zijlstra, dsahern, hpa, jolsa, linux-kernel, namhyung, acme,
	tglx, mingo

Commit-ID:  6acd8e9271cdeaec458fd4eec4a6765d16e0e61c
Gitweb:     http://git.kernel.org/tip/6acd8e9271cdeaec458fd4eec4a6765d16e0e61c
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 25 Nov 2015 16:36:54 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 26 Nov 2015 16:52:28 -0300

perf stat: Clear sample_(type|period) for counting

Clear sample_(type|period) for counting, as it only confuses debug
output with unwanted sampling details:

Before:

  $ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
  ------------------------------------------------------------
  perf_event_attr:
    type                             2
    size                             112
    config                           0x11
    { sample_period, sample_freq }   1
    sample_type                      TIME|CPU|PERIOD|RAW
    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
    disabled                         1
    inherit                          1
    enable_on_exec                   1
    exclude_guest                    1
  ...

After:
  $ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
  ------------------------------------------------------------
  perf_event_attr:
    type                             2
    size                             112
    config                           0x11
    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
    disabled                         1
    inherit                          1
    enable_on_exec                   1
    exclude_guest                    1
  ...

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1448465815-27404-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e77880b..df2fbf0 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -161,6 +161,13 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 
 	attr->inherit = !no_inherit;
 
+	/*
+	 * Some events get initialized with sample_(period/type) set,
+	 * like tracepoints. Clear it up for counting.
+	 */
+	attr->sample_period = 0;
+	attr->sample_type   = 0;
+
 	if (target__has_cpu(&target))
 		return perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel));
 

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

* [tip:perf/core] perf evlist: Display WEIGHT sample type bit
  2015-11-25 15:36 ` [PATCH 2/2] perf evlist: Display WEIGHT sample type bit Jiri Olsa
  2015-11-26 19:54   ` Arnaldo Carvalho de Melo
@ 2015-11-27  7:46   ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-11-27  7:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, a.p.zijlstra, mingo, dsahern, namhyung, linux-kernel, hpa,
	tglx, jolsa

Commit-ID:  dcdd184b60c3943fb678dcbaf899a26f845901ad
Gitweb:     http://git.kernel.org/tip/dcdd184b60c3943fb678dcbaf899a26f845901ad
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 25 Nov 2015 16:36:55 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 26 Nov 2015 16:54:00 -0300

perf evlist: Display WEIGHT sample type bit

Adding WIEGHT bit_name call to display sample_type properly.

  $ perf evlist -v
  cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|ID|CPU|DATA_SRC|WEIGHT ...

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1448465815-27404-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 397fb4e..0a1f4d9 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1192,6 +1192,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
 		bit_name(PERIOD), bit_name(STREAM_ID), bit_name(RAW),
 		bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
 		bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC),
+		bit_name(WEIGHT),
 		{ .name = NULL, }
 	};
 #undef bit_name

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

end of thread, other threads:[~2015-11-27  7:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25 15:36 [PATCH 1/2] perf stat: Clear sample_(type|period) for counting Jiri Olsa
2015-11-25 15:36 ` [PATCH 2/2] perf evlist: Display WEIGHT sample type bit Jiri Olsa
2015-11-26 19:54   ` Arnaldo Carvalho de Melo
2015-11-27  7:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-11-27  7:46 ` [tip:perf/core] perf stat: Clear sample_(type|period) for counting tip-bot for Jiri Olsa

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