Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966661AbbLRJJR (ORCPT ); Fri, 18 Dec 2015 04:09:17 -0500 Received: from terminus.zytor.com ([198.137.202.10]:52421 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932886AbbLRJJK (ORCPT ); Fri, 18 Dec 2015 04:09:10 -0500 Date: Fri, 18 Dec 2015 01:08:55 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: dsahern@gmail.com, hpa@zytor.com, a.p.zijlstra@chello.nl, kan.liang@intel.com, linux-kernel@vger.kernel.org, mingo@kernel.org, acme@redhat.com, tglx@linutronix.de, namhyung@kernel.org, jolsa@kernel.org Reply-To: jolsa@kernel.org, acme@redhat.com, namhyung@kernel.org, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, kan.liang@intel.com, hpa@zytor.com, dsahern@gmail.com In-Reply-To: <1446734469-11352-4-git-send-email-jolsa@kernel.org> References: <1446734469-11352-4-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat record: Initialize record features Git-Commit-ID: 3ba78bd00e508bf46a6aa2b8e296dc8287ea4c29 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 Content-Length: 2831 Lines: 79 Commit-ID: 3ba78bd00e508bf46a6aa2b8e296dc8287ea4c29 Gitweb: http://git.kernel.org/tip/3ba78bd00e508bf46a6aa2b8e296dc8287ea4c29 Author: Jiri Olsa AuthorDate: Thu, 5 Nov 2015 15:40:47 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 17 Dec 2015 15:15:17 -0300 perf stat record: Initialize record features Disabling all non stat related features. Also as we now enable STAT feature in the data file, adding code to instruct session open to skip sample type checking for stat data files. Signed-off-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Tested-by: Kan Liang Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1446734469-11352-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 15 +++++++++++++++ tools/perf/util/session.c | 3 +++ 2 files changed, 18 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index af2a3bf..c9c896a 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1310,6 +1310,19 @@ static const char * const recort_usage[] = { NULL, }; +static void init_features(struct perf_session *session) +{ + int feat; + + for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++) + perf_header__set_feat(&session->header, feat); + + perf_header__clear_feat(&session->header, HEADER_BUILD_ID); + perf_header__clear_feat(&session->header, HEADER_TRACING_DATA); + perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK); + perf_header__clear_feat(&session->header, HEADER_AUXTRACE); +} + static int __cmd_record(int argc, const char **argv) { struct perf_session *session; @@ -1331,6 +1344,8 @@ static int __cmd_record(int argc, const char **argv) if (perf_stat.file.is_pipe) return -EINVAL; + init_features(session); + session->evlist = evsel_list; perf_stat.session = session; perf_stat.record = true; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index a90c74b..d5636ba 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -37,6 +37,9 @@ static int perf_session__open(struct perf_session *session) if (perf_data_file__is_pipe(file)) return 0; + if (perf_header__has_feat(&session->header, HEADER_STAT)) + return 0; + if (!perf_evlist__valid_sample_type(session->evlist)) { pr_err("non matching sample_type\n"); return -1; -- 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/