diff options
author | Namhyung Kim <namhyung@kernel.org> | 2021-08-27 16:32:12 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-08-30 18:22:23 -0300 |
commit | bb07d62e039b592f8006c9faedab48cd627e20c4 (patch) | |
tree | 032b20b72ed0a23762c8dd56dc91a98fde758c4b /tools/perf/builtin-record.c | |
parent | 1c02f6c9043e9a6f359278cc2f17b4283ac0bd67 (diff) | |
download | linux-stable-bb07d62e039b592f8006c9faedab48cd627e20c4.tar.gz linux-stable-bb07d62e039b592f8006c9faedab48cd627e20c4.tar.bz2 linux-stable-bb07d62e039b592f8006c9faedab48cd627e20c4.zip |
perf record: Fix wrong comm in system-wide mode with delay
Stephane found that the name of the forked process in a system-wide
mode is wrong when --delay option is used. For example,
# perf record -a --delay=1000 noploop 3
The noploop process will run a busy loop for 3 second. And on an idle
machine it should show up at the top in the perf report. It works
well without the --delay option. But if I add the option, it showed
'perf' not 'noploop'.
# perf report -s comm -q | head -3
52.94% perf
16.65% swapper
12.04% chrome
It turned out that the dummy event didn't work at all and it missed
COMM and MMAP events for the noploop process (and others too). We
should enable the dummy event immediately in system-wide mode, as the
enable-on-exec would work only for task events.
With this change,
# perf report -s comm -q | head -3
52.75% noploop
17.03% swapper
12.83% chrome
Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210827233212.3121037-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index cc801fecf079..06c4dca0c466 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -910,7 +910,8 @@ static int record__open(struct record *rec) * Enable the dummy event when the process is forked for * initial_delay, immediately for system wide. */ - if (opts->initial_delay && !pos->immediate) + if (opts->initial_delay && !pos->immediate && + !target__has_cpu(&opts->target)) pos->core.attr.enable_on_exec = 1; else pos->immediate = 1; |