]> Git Repo - linux.git/commitdiff
perf stat record: Keep sample_type 0 for pipe session
authorJiri Olsa <[email protected]>
Tue, 5 Jan 2016 21:09:05 +0000 (22:09 +0100)
committerArnaldo Carvalho de Melo <[email protected]>
Wed, 6 Jan 2016 23:11:14 +0000 (20:11 -0300)
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.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-stat.c

index 9805e03ab1638c782efa5626f41ed65b2497fc4f..7f568244662b0abecb5a6b402275b63bb17ace9f 100644 (file)
@@ -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
This page took 0.057177 seconds and 4 git commands to generate.