Re: [PATCH] perf stat: Do not show stats if workload fails

From: Arnaldo Carvalho de Melo
Date: Tue Dec 24 2013 - 07:53:58 EST


Em Mon, Dec 23, 2013 at 07:29:54PM -0500, David Ahern escreveu:
> On 12/23/13, 2:37 PM, Arnaldo Carvalho de Melo wrote:
> >int perf_evlist__start_workload(struct perf_evlist *evlist)
> >{
> > if (evlist->workload.cork_fd > 0) {
> > char bf = 0;
> > /* Remove the cork, let it rip! */
> > int ret = write(evlist->workload.cork_fd, &bf, 1);
> > if (ret < 0)
> > perror("enable to write to pipe");
> >
> > close(evlist->workload.cork_fd);
> > return ret;
> > }
> > return 0;
> >}

> >Ret there is 1, so we need to change it to:

> > return ret != 1 ? -1 : 0;

> >Right?

> Yes, nice catch.

But this doesn't really matters, if one uses the more usual:

if (function() < 0)

pattern for error checking, there would be no problem, and we would only
be checking that we told perf_evlist__prepare_workload()'s fork branch
to call execvp, not to check what happens then, i.e. if it finds the
specified workload in the system's PATH, if there are no permission of
file format problems, etc.

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?

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/