Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161643AbbKEOz1 (ORCPT ); Thu, 5 Nov 2015 09:55:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46709 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161684AbbKEOlU (ORCPT ); Thu, 5 Nov 2015 09:41:20 -0500 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra , "Liang, Kan" Subject: [PATCH 03/25] perf stat record: Initialize record features Date: Thu, 5 Nov 2015 15:40:47 +0100 Message-Id: <1446734469-11352-4-git-send-email-jolsa@kernel.org> In-Reply-To: <1446734469-11352-1-git-send-email-jolsa@kernel.org> References: <1446734469-11352-1-git-send-email-jolsa@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2260 Lines: 69 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. Tested-by: Kan Liang Link: http://lkml.kernel.org/n/tip-0av5yfkwyywwgoiali88w4hi@git.kernel.org Signed-off-by: Jiri Olsa --- 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 04123835fd81..2abf45d67ff2 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1261,6 +1261,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; @@ -1282,6 +1295,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 cc3bda2fc78b..dab5277a71c4 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"); return -1; -- 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/