Skip to content

Commit 448ce0e

Browse files
ligangkernelacmel
authored andcommitted
perf stat: Enable ignore_missing_thread
perf already support ignore_missing_thread for -p, but not yet applied to `perf stat -p <pid>`. This patch enables ignore_missing_thread for `perf stat -p <pid>`. Committer notes: And here is a refresher about the 'ignore_missing_thread' knob, from a previous patch using it: ca80006 ("perf evsel: Enable ignore_missing_thread for pid option") --- While monitoring a multithread process with pid option, perf sometimes may return sys_perf_event_open failure with 3(No such process) if any of the process's threads die before we open the event. However, we want perf continue monitoring the remaining threads and do not exit with error. --- Signed-off-by: Gang Li <ligang.bdlg@bytedance.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20220622030037.15005-1-ligang.bdlg@bytedance.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 37ed2cd commit 448ce0e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/perf/builtin-stat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,6 +2586,8 @@ int cmd_stat(int argc, const char **argv)
25862586
if (evlist__initialize_ctlfd(evsel_list, stat_config.ctl_fd, stat_config.ctl_fd_ack))
25872587
goto out;
25882588

2589+
/* Enable ignoring missing threads when -p option is defined. */
2590+
evlist__first(evsel_list)->ignore_missing_thread = target.pid;
25892591
status = 0;
25902592
for (run_idx = 0; forever || run_idx < stat_config.run_count; run_idx++) {
25912593
if (stat_config.run_count != 1 && verbose > 0)

0 commit comments

Comments
 (0)