[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b43873d9-2b29-23ed-2187-9e2eb31ee587@linux.intel.com>
Date: Mon, 6 Jul 2020 16:10:14 +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 v9 11/15] perf stat: implement control commands handling
On 06.07.2020 15:37, Jiri Olsa wrote:
> On Fri, Jul 03, 2020 at 10:47:22AM +0300, Alexey Budankov wrote:
>
> SNIP
>
>>
>> while (1) {
>> if (forks)
>> @@ -574,11 +610,22 @@ static int dispatch_events(bool forks, int timeout, int interval, int *times, st
>> if (done || stop || child_exited)
>> break;
>>
>> - nanosleep(ts, NULL);
>> - if (timeout)
>> - stop = true;
>> - else
>> - stop = handle_interval(interval, times);
>> + clock_gettime(CLOCK_MONOTONIC, &time_start);
>> + if (!(evlist__poll(evsel_list, time_to_sleep) > 0)) { /* poll timeout or EINTR */
>> + if (timeout)
>> + stop = true;
>> + else
>> + stop = handle_interval(interval, times);
>> + time_to_sleep = sleep_time;
>> + } else { /* fd revent */
>> + stop = process_evlist(evsel_list, interval, times);
>> + clock_gettime(CLOCK_MONOTONIC, &time_stop);
>> + diff_timespec(&time_diff, &time_stop, &time_start);
>> + time_to_sleep -= time_diff.tv_sec * MSEC_PER_SEC +
>> + time_diff.tv_nsec / NSEC_PER_MSEC;
>> + if (time_to_sleep < 0)
>> + time_to_sleep = 0;
>
> could this computation go to a separate function? something like:
>
> time_to_sleep = compute_tts(time_start, time_stop);
Accepted. In v10.
Alexey
Powered by blists - more mailing lists