From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH] perf stat: Do not show stats if workload fails
Date: Tue, 24 Dec 2013 10:30:03 -0300 [thread overview]
Message-ID: <20131224133003.GA23382@ghostprotocols.net> (raw)
In-Reply-To: <20131224125342.GC17780@ghostprotocols.net>
Em Tue, Dec 24, 2013 at 09:53:42AM -0300, Arnaldo Carvalho de Melo escreveu:
> The thing to check is perf_evlist__{prepare,start}_workload notification
> errors using SIGUSR1, that we need to check for in the caller, and emit
> the message, no?
Something like this:
1. We tell perf_evlist__prepare_workload that we want a signal if execvp
fails, it will be a SIGUSR1
2. We catch that signal in 'stat' and check that we got a signal, only
problem so far with this signal maze is that we're getting a SIGCHLD
while I was expecting a SIGUSR1... I.e. the "if (signr != -1) test
really should be if (signr == SIGUSR1), but I'm getting a SIGCHLD there
and the elves are tugging me away...
- Arnaldo
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index dab98b50c9fe..d2350fef8cde 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -144,6 +144,7 @@ static struct timespec ref_time;
static struct cpu_map *aggr_map;
static int (*aggr_get_id)(struct cpu_map *m, int cpu);
+static volatile int signr = -1;
static volatile int done = 0;
struct perf_stat {
@@ -531,7 +532,7 @@ static int __run_perf_stat(int argc, const char **argv)
if (forks) {
if (perf_evlist__prepare_workload(evsel_list, &target, argv,
- false, false) < 0) {
+ false, true) < 0) {
perror("failed to prepare workload");
return -1;
}
@@ -598,6 +599,8 @@ static int __run_perf_stat(int argc, const char **argv)
wait(&status);
if (WIFSIGNALED(status))
psignal(WTERMSIG(status), argv[0]);
+ else if (signr != -1)
+ return -1;
} else {
handle_initial_delay();
while (!done) {
@@ -1335,8 +1338,6 @@ static void print_stat(int argc, const char **argv)
}
}
-static volatile int signr = -1;
-
static void skip_signal(int signo)
{
if ((child_pid == -1) || interval)
@@ -1785,6 +1786,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
signal(SIGCHLD, skip_signal);
signal(SIGALRM, skip_signal);
signal(SIGABRT, skip_signal);
+ signal(SIGUSR1, skip_signal);
status = 0;
for (run_idx = 0; forever || run_idx < run_count; run_idx++) {
next prev parent reply other threads:[~2013-12-24 13:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 5:52 [PATCH] perf stat: Do not show stats if workload fails David Ahern
2013-12-20 7:57 ` Ingo Molnar
2013-12-23 19:37 ` Arnaldo Carvalho de Melo
2013-12-24 0:29 ` David Ahern
2013-12-24 12:53 ` Arnaldo Carvalho de Melo
2013-12-24 13:30 ` Arnaldo Carvalho de Melo [this message]
2013-12-26 14:11 ` David Ahern
2013-12-26 14:15 ` Arnaldo Carvalho de Melo
2013-12-26 14:18 ` David Ahern
2013-12-26 14:26 ` Arnaldo Carvalho de Melo
2013-12-26 14:55 ` Arnaldo Carvalho de Melo
2014-01-02 14:44 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131224133003.GA23382@ghostprotocols.net \
--to=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox