aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-11-05 09:40:47 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-12-17 13:15:17 -0500
commit3ba78bd00e508bf46a6aa2b8e296dc8287ea4c29 (patch)
treed7fb49a89d65dd40b7497bdff22808822877ac4e /tools
parent4979d0c7d0c73a3e799d4dcfbacd3cd11cc55638 (diff)
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 <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Kan Liang <kan.liang@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1446734469-11352-4-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c15
-rw-r--r--tools/perf/util/session.c3
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index af2a3bf659f7..c9c896a94fee 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1310,6 +1310,19 @@ static const char * const recort_usage[] = {
1310 NULL, 1310 NULL,
1311}; 1311};
1312 1312
1313static void init_features(struct perf_session *session)
1314{
1315 int feat;
1316
1317 for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++)
1318 perf_header__set_feat(&session->header, feat);
1319
1320 perf_header__clear_feat(&session->header, HEADER_BUILD_ID);
1321 perf_header__clear_feat(&session->header, HEADER_TRACING_DATA);
1322 perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK);
1323 perf_header__clear_feat(&session->header, HEADER_AUXTRACE);
1324}
1325
1313static int __cmd_record(int argc, const char **argv) 1326static int __cmd_record(int argc, const char **argv)
1314{ 1327{
1315 struct perf_session *session; 1328 struct perf_session *session;
@@ -1331,6 +1344,8 @@ static int __cmd_record(int argc, const char **argv)
1331 if (perf_stat.file.is_pipe) 1344 if (perf_stat.file.is_pipe)
1332 return -EINVAL; 1345 return -EINVAL;
1333 1346
1347 init_features(session);
1348
1334 session->evlist = evsel_list; 1349 session->evlist = evsel_list;
1335 perf_stat.session = session; 1350 perf_stat.session = session;
1336 perf_stat.record = true; 1351 perf_stat.record = true;
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index a90c74b67e43..d5636ba94b20 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)
37 if (perf_data_file__is_pipe(file)) 37 if (perf_data_file__is_pipe(file))
38 return 0; 38 return 0;
39 39
40 if (perf_header__has_feat(&session->header, HEADER_STAT))
41 return 0;
42
40 if (!perf_evlist__valid_sample_type(session->evlist)) { 43 if (!perf_evlist__valid_sample_type(session->evlist)) {
41 pr_err("non matching sample_type\n"); 44 pr_err("non matching sample_type\n");
42 return -1; 45 return -1;