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 <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
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)