Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1302213

[PATCH 1/8] perf stat record: Keep sample_type 0 for pipe session

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 1/8] perf stat record: Keep sample_type 0 for pipe session
Date 2016-01-05 22:20 +0100
Message-ID <qNHbl-8sH-45@gated-at.bofh.it> (permalink)
References <qNHbk-8sH-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


For pipe sessions we need to keep sample_type zero,
because script's perf_evsel__check_attr is triggered
by sample_type != 0, and the check would fail on
stat session.

I was tempted to keep it zero unconditionally, but the
pipe session is sufficient. In perf.data session we
are guarded by HEADER_STAT feature.

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

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 9805e03ab163..7f568244662b 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -184,11 +184,18 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 	 * like tracepoints. Clear it up for counting.
 	 */
 	attr->sample_period = 0;
+
 	/*
 	 * But set sample_type to PERF_SAMPLE_IDENTIFIER, which should be harmless
 	 * while avoiding that older tools show confusing messages.
+	 *
+	 * However for pipe sessions we need to keep it zero,
+	 * because script's perf_evsel__check_attr is triggered
+	 * by attr->sample_type != 0, and we can't run it on
+	 * stat sessions.
 	 */
-	attr->sample_type   = PERF_SAMPLE_IDENTIFIER;
+	if (!(STAT_RECORD && perf_stat.file.is_pipe))
+		attr->sample_type = PERF_SAMPLE_IDENTIFIER;
 
 	/*
 	 * Disabling all counters initially, they will be enabled
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv8 0/8] perf stat: Add scripting support Jiri Olsa <jolsa@kernel.org> - 2016-01-05 22:20 +0100
  [PATCH 5/8] perf script: Add stat default handlers Jiri Olsa <jolsa@kernel.org> - 2016-01-05 22:20 +0100
    [tip:perf/core] perf script: Add stat default handlers tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-01-09 17:40 +0100
  [PATCH 1/8] perf stat record: Keep sample_type 0 for pipe session Jiri Olsa <jolsa@kernel.org> - 2016-01-05 22:20 +0100
    [tip:perf/core] perf stat record:   Keep sample_type 0 for pipe session tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-01-09 17:30 +0100
  [PATCH 8/8] perf script: Add stat-cpi.py script Jiri Olsa <jolsa@kernel.org> - 2016-01-05 22:20 +0100
    Re: [PATCH 8/8] perf script: Add stat-cpi.py script Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-06 00:00 +0100
  [PATCH 6/8] perf script: Display stat events by default Jiri Olsa <jolsa@kernel.org> - 2016-01-05 22:20 +0100
    Re: [PATCH 6/8] perf script: Display stat events by default Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-05 23:50 +0100
      Re: [PATCH 6/8] perf script: Display stat events by default Jiri Olsa <jolsa@redhat.com> - 2016-01-06 10:40 +0100
  [PATCH 2/8] perf script: Process cpu/threads maps Jiri Olsa <jolsa@kernel.org> - 2016-01-05 22:20 +0100
    [tip:perf/core] perf script: Process cpu/threads maps tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-01-09 17:30 +0100
  [PATCH 4/8] perf script: Add process_stat/process_stat_interval scripting interface Jiri Olsa <jolsa@kernel.org> - 2016-01-05 22:20 +0100
    [tip:perf/core] perf script: Add process_stat/  process_stat_interval scripting interface tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-01-09 17:40 +0100
  Re: [PATCHv8 0/8] perf stat: Add scripting support Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-05 23:40 +0100
    Re: [PATCHv8 0/8] perf stat: Add scripting support Jiri Olsa <jolsa@redhat.com> - 2016-01-06 10:10 +0100

csiph-web