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

Li Wang liwang@redhat.com
Sat Mar 26 14:28:43 CET 2022


Waiman Long <longman@redhat.com> wrote:


> >   static void setup(void)
> >   {
> > +     delta = 1000/sysconf(_SC_CLK_TCK) + 5;
> >       if (tst_is_virt(VIRT_ANY)) {
> >               tst_res(TINFO, "Running in a virtual machine, multiply the
> delta by 10.");
> >               delta *= 10;
>
> Actually, only CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE use
> clock tick for its time measurement. The rests use a higher resolution
> internal timer. Perhaps, we could have a separate coarse_delta for these
> two cases and use delta for the rest.
>

Good point, at least for aarch64 the CLOCK*_COARSE makes use
of the clock tick is 10ms.

However, as many architectures have varying tick rates and use
dynamically timer, maybe a further method is to get it via clock_getres()
just like Cyril mentioned in another email.

(I draft patch V2 in that email, feel free to review)

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


More information about the ltp mailing list