Re: [PATCH v8 04/13] perf stat: factor out body of event handling loop for system wide
From: Alexey Budankov
Date: Thu Jun 25 2020 - 14:44:03 EST
On 25.06.2020 20:13, Jiri Olsa wrote:
> On Thu, Jun 25, 2020 at 07:01:08PM +0300, Alexey Budankov wrote:
>
> SNIP
>
>>>>
>>>> Well, ok.
>>>>
>>>> I will rename process_interval() to __process_interval() and
>>>> then print_interval() to process_interval().
>>>>
>>>> Regarding timeout let's have it like this:
>>>>
>>>> static bool process_timeout(int timeout)
>>>> {
>>>> return timeout ? true : false;
>>>> }
>>>
>>> can't this just stay as value check after finished poll?
>>>
>>> if (timeout)
>>> break;
>>>
>>> and then separate call to process_interval(interval, times)?
>>
>> Like this? Still makes sense to have it in a single function.
>>
>> static bool process_timing_settings(int timeout, unsigned int interval, int *times)
>> {
>> bool res = timeout ? true : false;
>> if (!res)
>> res = process_interval(interval, times);
>> return res;
>> }
>
> I don't see the connection between timeout and interval
> IMO this just complicates things, is there a problem to
> keep it separated as it is now?
Not a problem. Can duplicate it in dispatch_events().
~Alexey