diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-03 12:56:49 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-13 08:06:21 -0500 |
commit | 735f7e0bbebe755d707182188c4a5e88c581fc1c (patch) | |
tree | f77574a5093cc1966004dd6ec81d9606d67631f2 /tools/perf/builtin-stat.c | |
parent | f33cbe72e6166b97d6fa2400cb00a885b47999d7 (diff) |
perf evlist: Move the SIGUSR1 error reporting logic to prepare_workload
So that we have the boilerplate in the preparation method, instead of
open coded in tools wanting the reporting when the exec fails.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-purbdzcphdveskh7wwmnm4t7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r-- | tools/perf/builtin-stat.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 9d0d52d55ee6..f8456cad656d 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -58,7 +58,6 @@ | |||
58 | #include "util/thread.h" | 58 | #include "util/thread.h" |
59 | #include "util/thread_map.h" | 59 | #include "util/thread_map.h" |
60 | 60 | ||
61 | #include <signal.h> | ||
62 | #include <stdlib.h> | 61 | #include <stdlib.h> |
63 | #include <sys/prctl.h> | 62 | #include <sys/prctl.h> |
64 | #include <locale.h> | 63 | #include <locale.h> |
@@ -542,8 +541,8 @@ static int __run_perf_stat(int argc, const char **argv) | |||
542 | } | 541 | } |
543 | 542 | ||
544 | if (forks) { | 543 | if (forks) { |
545 | if (perf_evlist__prepare_workload(evsel_list, &target, argv, | 544 | if (perf_evlist__prepare_workload(evsel_list, &target, argv, false, |
546 | false, true) < 0) { | 545 | workload_exec_failed_signal) < 0) { |
547 | perror("failed to prepare workload"); | 546 | perror("failed to prepare workload"); |
548 | return -1; | 547 | return -1; |
549 | } | 548 | } |
@@ -598,18 +597,6 @@ static int __run_perf_stat(int argc, const char **argv) | |||
598 | clock_gettime(CLOCK_MONOTONIC, &ref_time); | 597 | clock_gettime(CLOCK_MONOTONIC, &ref_time); |
599 | 598 | ||
600 | if (forks) { | 599 | if (forks) { |
601 | struct sigaction act = { | ||
602 | .sa_flags = SA_SIGINFO, | ||
603 | .sa_sigaction = workload_exec_failed_signal, | ||
604 | }; | ||
605 | /* | ||
606 | * perf_evlist__prepare_workload will, after we call | ||
607 | * perf_evlist__start_Workload, send a SIGUSR1 if the exec call | ||
608 | * fails, that we will catch in workload_signal to flip | ||
609 | * workload_exec_errno. | ||
610 | */ | ||
611 | sigaction(SIGUSR1, &act, NULL); | ||
612 | |||
613 | perf_evlist__start_workload(evsel_list); | 600 | perf_evlist__start_workload(evsel_list); |
614 | handle_initial_delay(); | 601 | handle_initial_delay(); |
615 | 602 | ||