[LTP] [PATCH] clock_gettime04: set threshold based on the clock tick rate

Li Wang liwang@redhat.com
Mon Mar 28 12:13:09 CEST 2022


Hi Cyril,

Sorry, I didn't complete my input but sent the email by touch
key combination...  Comments in below.

On Mon, Mar 28, 2022 at 5:54 PM Li Wang <liwang@redhat.com> wrote:


>
>> I did multiply it with 5 just to add some error margin. I guess that we
>> can as well multiply it with 2 if that works well enough.
>>
>
> Ok, I'd like to multiply 5 in case VM needs more.
>
>
>> I do not think that we should get resolution for each clock, the COARSE
>> clock should have the worst resolution of all clocks.
>>
>
> Yes, quite enough for the rest.
> For precise clock, the second part will be zero since divided by 1000000.
>
>     delta = 5 + (res.tv_nsec / 1000000) * 5;
>


My concern here is that seems a bit looser to the rest clocks.
Because "10ms" as delta is a big value to the precise clock since
the resolution of some is only 1ns.
(The delta will be "10ms" on x86_64 and "15ms" on aarch64.)

In my path V2, we can make the second part _zero_ by dividing 1000000.
Then we can keep using the proper delta for each clock.


Test data from x86_64:
========

clock_gettime04.c:108: TINFO: CLOCK_REALTIME: resolution is 1ns
clock_gettime04.c:112: TINFO: delta = : 5
...
clock_gettime04.c:108: TINFO: CLOCK_REALTIME_COARSE: resolution is 1000000ns
clock_gettime04.c:112: TINFO: delta = : 10
clock_gettime04.c:108: TINFO: CLOCK_MONOTONIC: resolution is 1ns
clock_gettime04.c:112: TINFO: delta = : 5
clock_gettime04.c:108: TINFO: CLOCK_MONOTONIC_COARSE: resolution is
1000000ns
clock_gettime04.c:112: TINFO: delta = : 10
clock_gettime04.c:108: TINFO: CLOCK_MONOTONIC_RAW: resolution is 1ns
clock_gettime04.c:112: TINFO: delta = : 5
clock_gettime04.c:108: TINFO: CLOCK_BOOTTIME: resolution is 1ns
clock_gettime04.c:112: TINFO: delta = : 5



>
>
> Test data from aarch4 (kernel-5.14) FYI:
> ===================
> clock_gettime04.c:108: TINFO: CLOCK_REALTIME: resolution is 1ns
> ...
> clock_gettime04.c:108: TINFO: CLOCK_REALTIME_COARSE: resolution is
> 10000000ns
> clock_gettime04.c:108: TINFO: CLOCK_MONOTONIC: resolution is 1ns
> clock_gettime04.c:108: TINFO: CLOCK_MONOTONIC_COARSE: resolution is
> 10000000ns
> clock_gettime04.c:108: TINFO: CLOCK_MONOTONIC_RAW: resolution is 1ns
> clock_gettime04.c:108: TINFO: CLOCK_BOOTTIME: resolution is 1ns
>
>
> --
> Regards,
> Li Wang
>


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220328/66985964/attachment.htm>


More information about the ltp mailing list