[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4aa8c212-7bc7-3689-03ad-5ce6fd0e6356@linux.intel.com>
Date: Wed, 24 Jun 2020 16:27:26 +0300
From: Alexey Budankov <alexey.budankov@...ux.intel.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v8 07/13] perf stat: factor out event handling loop into
dispatch_events()
On 23.06.2020 17:56, Jiri Olsa wrote:
> On Wed, Jun 17, 2020 at 11:40:03AM +0300, Alexey Budankov wrote:
>>
>> Consolidate event dispatching loops for fork, attach and system
>> wide monitoring use cases into common dispatch_events() function.
>>
>> Signed-off-by: Alexey Budankov <alexey.budankov@...ux.intel.com>
>> ---
>> tools/perf/builtin-stat.c | 35 ++++++++++++++++++++++++-----------
>> 1 file changed, 24 insertions(+), 11 deletions(-)
>>
>> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
>> index 3bc538576607..39749c290508 100644
>> --- a/tools/perf/builtin-stat.c
>> +++ b/tools/perf/builtin-stat.c
>> @@ -557,6 +557,27 @@ static bool is_target_alive(struct target *_target,
>> return false;
>> }
>>
>> +static int dispatch_events(bool forks, int timeout, int interval, int *times, struct timespec *ts)
>> +{
>> + bool stop = false;
>> + int child = 0, status = 0;
>> +
>> + while (1) {
>> + if (forks)
>> + child = waitpid(child_pid, &status, WNOHANG);
>> + else
>> + child = !is_target_alive(&target, evsel_list->core.threads) ? 1 : 0;
>
> please renme child to something more accurate, so the condition
> below makes more sense, like child_stoped or such
Well, let's have it named like child_stopped.
~Alexey
>
> jirka
>
>> +
>> + if (done || stop || child)
>> + break;
>> +
>> + nanosleep(ts, NULL);
>> + stop = process_timeout(timeout, interval, times);
>> + }
>> +
>> + return status;
>> +}
>> +
>
> SNIP
>
Powered by blists - more mailing lists