From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756466AbcAIQ3b (ORCPT ); Sat, 9 Jan 2016 11:29:31 -0500 Received: from terminus.zytor.com ([198.137.202.10]:41884 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755819AbcAIQ32 (ORCPT ); Sat, 9 Jan 2016 11:29:28 -0500 Date: Sat, 9 Jan 2016 08:29:13 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: linux-kernel@vger.kernel.org, dsahern@gmail.com, tglx@linutronix.de, kan.liang@intel.com, a.p.zijlstra@chello.nl, mingo@kernel.org, jolsa@kernel.org, hpa@zytor.com, acme@redhat.com, namhyung@kernel.org Reply-To: jolsa@kernel.org, mingo@kernel.org, a.p.zijlstra@chello.nl, kan.liang@intel.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, dsahern@gmail.com, namhyung@kernel.org, acme@redhat.com, hpa@zytor.com In-Reply-To: <1452028152-26762-2-git-send-email-jolsa@kernel.org> References: <1452028152-26762-2-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat record: Keep sample_type 0 for pipe session Git-Commit-ID: 6db1a5c190d6abe416ea36aa28a6c53e0b3bbd5e X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6db1a5c190d6abe416ea36aa28a6c53e0b3bbd5e Gitweb: http://git.kernel.org/tip/6db1a5c190d6abe416ea36aa28a6c53e0b3bbd5e Author: Jiri Olsa AuthorDate: Tue, 5 Jan 2016 22:09:05 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 6 Jan 2016 20:11:14 -0300 perf stat record: Keep sample_type 0 for pipe session 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 Cc: David Ahern Cc: Kan Liang Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1452028152-26762-2-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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 9805e03..7f56824 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