Re: [PATCH] perf stat: Poll for monitored tasks being alive in fork mode
From: Jiri Olsa
Date: Sun Jan 06 2019 - 10:57:57 EST
On Sun, Jan 06, 2019 at 10:02:18PM +0800, Jin, Yao wrote:
SNIP
> > ---
> > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> > index acfd48db52dd..c322cb271180 100644
> > --- a/tools/perf/builtin-stat.c
> > +++ b/tools/perf/builtin-stat.c
> > @@ -583,6 +583,14 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
> > if (interval || timeout) {
> > while (!waitpid(child_pid, &status, WNOHANG)) {
> > + if (!is_target_alive(&target, evsel_list->threads)) {
> > + int pid = child_pid;
> > +
> > + if (pid != -1)
> > + kill(pid, SIGTERM);
> > + break;
> > + }
> > +
> > nanosleep(&ts, NULL);
> > if (timeout)
> > break;
> >
>
> Hi Jiri,
>
> I think your patch is good. At least, we can avoid the case of kill(-1,
> SIGTERM).
>
> BTW, you post this patch or I re-post it, both fine for me. :)
please post it
thanks,
jirka