Re: [PATCH] perf record: enable multiplexing scaling via -R

From: Jiri Olsa
Date: Fri Sep 01 2017 - 03:56:04 EST


On Wed, Aug 30, 2017 at 11:21:23PM -0700, Stephane Eranian wrote:

SNIP

> I am also surprised to see that perf record keep inherit=1 in
> system-wide mode. I don't think this
> is relavant in this mode. But the kernel this fails in this case,
> which I think is a bug. In system-wide
> mode, the attr-.no_inherit should be ignored. We can fix perf record
> to avoid this in system-wide.

agreed, how about attached patch

jirka


---
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 9bdea047c5db..e3cf1bd463f9 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -158,6 +158,7 @@ OPTIONS
-a::
--all-cpus::
System-wide collection from all CPUs (default if no target is specified).
+ Disables inheritance of counters (forces --no-inherit option).

-p::
--pid=::
@@ -277,6 +278,7 @@ Collect samples only on the list of CPUs provided. Multiple CPUs can be provided
comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
In per-thread mode with inheritance mode on (default), samples are captured only when
the thread executes on the designated CPUs. Default is to monitor all CPUs.
+Disables inheritance of counters (forces --no-inherit option).

-B::
--no-buildid::
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d9bd632ed7db..22308c42321d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -850,7 +850,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
bool per_cpu = opts->target.default_per_cpu && !opts->target.per_thread;

attr->sample_id_all = perf_missing_features.sample_id_all ? 0 : 1;
- attr->inherit = !opts->no_inherit;
+ attr->inherit = !opts->no_inherit && !target__has_cpu(&opts->target);
attr->write_backward = opts->overwrite ? 1 : 0;

perf_evsel__set_sample_bit(evsel, IP);