diff options
author | Jin Yao <yao.jin@linux.intel.com> | 2019-10-11 08:05:45 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-10-15 14:39:42 +0300 |
commit | dd071024bf52156eed31deaf511c6e7a82a6f57b (patch) | |
tree | fd0ddc932acbfe49c895b2c86810a38ab9d894fa /tools/perf/util/stat.c | |
parent | 5fb470bc29d8e2ff0e1cab4fbb580a06da11ab28 (diff) | |
download | linux-dd071024bf52156eed31deaf511c6e7a82a6f57b.tar.xz |
perf stat: Support --all-kernel/--all-user
'perf record' has supported --all-kernel / --all-user to configure all
used events to run in kernel space or run in user space. But 'perf stat'
doesn't support these options.
It would be useful to support these options in 'perf stat' too to keep
the same semantics available in both tools.
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20191011050545.3899-1-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/stat.c')
-rw-r--r-- | tools/perf/util/stat.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index ebdd130557fb..6822e4ffe224 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -490,6 +490,16 @@ int create_perf_stat_counter(struct evsel *evsel, if (config->identifier) attr->sample_type = PERF_SAMPLE_IDENTIFIER; + if (config->all_user) { + attr->exclude_kernel = 1; + attr->exclude_user = 0; + } + + if (config->all_kernel) { + attr->exclude_kernel = 0; + attr->exclude_user = 1; + } + /* * Disabling all counters initially, they will be enabled * either manually by us or by kernel via enable_on_exec |