Re: [PATCH v2] perf record: encode -k clockid frequency into Perf trace

From: Alexey Budankov
Date: Wed Oct 03 2018 - 10:41:10 EST


Hi,

On 03.10.2018 16:39, Jiri Olsa wrote:
> On Wed, Oct 03, 2018 at 10:01:56AM +0300, Alexey Budankov wrote:
<SNIP>
>> + if (rec->opts.use_clockid && rec->opts.clockid_res_ns)
>> + session->header.env.clockid_res_ns = rec->opts.clockid_res_ns;
>> + else
>> + perf_header__clear_feat(&session->header, HEADER_CLOCKID);
>> +
>
> could you please keep only bits setting in record__init_features
> and move the header.env.clockid_res_ns assignment out of it?

Ok. Accepted.

>
<SNIP>
>> +static int get_clockid_res(clockid_t clk_id, size_t *res_ns)
>> +{
>> + struct timespec res;
>> +
>> + *res_ns = 0;
>> + if (!clock_getres(clk_id, &res))
>> + *res_ns = res.tv_nsec + res.tv_sec * NSEC_PER_SEC;
>
> hum, if this one fails (which I guess is unlikely) we should tell
> and probably even quit

Makes sense. Please stay tuned for v3.

Thanks,
Alexey