[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170824162737.7813-11-jolsa@kernel.org>
Date: Thu, 24 Aug 2017 18:27:37 +0200
From: Jiri Olsa <jolsa@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
David Ahern <dsahern@...il.com>,
Andi Kleen <andi@...stfloor.org>,
Mark Rutland <mark.rutland@....com>
Subject: [PATCH 10/10] perf stat: Support inherit/no-inherit terms
Adding support to use 'inherit' and 'no-inherit' terms
in perf stat command, like:
To disable perf_event_attr::inherit (enabled by default):
$ perf stat -e cpu/cpu-cycles,no-inherit/u ...
Enable perf_event_attr::inherit (disabled by -i):
$ perf stat -i -e cpu/cpu-cycles,inherit/u ...
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/perf/builtin-stat.c | 19 +++++++++++++++++++
tools/perf/util/parse-events.c | 2 ++
2 files changed, 21 insertions(+)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 866da7aa54bf..92053b93e452 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -210,6 +210,23 @@ static void perf_stat__reset_stats(void)
perf_stat__reset_shadow_stats();
}
+static void apply_stat_config_terms(struct perf_evsel *evsel)
+{
+ struct perf_evsel_config_term *term;
+ struct list_head *config_terms = &evsel->config_terms;
+ struct perf_event_attr *attr = &evsel->attr;
+
+ list_for_each_entry(term, config_terms, list) {
+ switch (term->type) {
+ case PERF_EVSEL__CONFIG_TERM_INHERIT:
+ attr->inherit = term->val.inherit ? 1 : 0;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
static int create_perf_stat_counter(struct perf_evsel *evsel)
{
struct perf_event_attr *attr = &evsel->attr;
@@ -264,6 +281,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
attr->enable_on_exec = 1;
}
+ apply_stat_config_terms(evsel);
+
if (target__has_cpu(&target))
return perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel));
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f44aeba51d1f..b2b448ff0a36 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -934,6 +934,8 @@ config_term_avail(int term_type, struct parse_events_error *err)
case PARSE_EVENTS__TERM_TYPE_CONFIG2:
case PARSE_EVENTS__TERM_TYPE_NAME:
case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
+ case PARSE_EVENTS__TERM_TYPE_INHERIT:
+ case PARSE_EVENTS__TERM_TYPE_NOINHERIT:
return true;
default:
if (!err)
--
2.9.5
Powered by blists - more mailing lists