ltp icon indicating copy to clipboard operation
ltp copied to clipboard

Update clock_gettime04.c

Open jiaoff opened this issue 4 years ago • 7 comments

Only considers that the configuration is 250Hz when delta = 5. When 100Hz is configured, the delta must be greater than 10ms. So modify delta = 11. Resolve:

  1. TFAIL: CLOCK_REALTIME_COARSE(vDSO with old kernel spec): Difference between successive readings greater than 5 ms (2): 10
  2. TFAIL: CLOCK_MONOTONIC_COARSE(vDSO with old kernel spec): Difference between successive readings greater than 5 ms (2): 10

jiaoff avatar Dec 31 '21 02:12 jiaoff

Can we instead just get the clock resolution and base the delta on that? We can call clock_getres() for the CLOCK_REALTIME_COARSE and if that succeeds we can use the tv_nsec rounded up to to miliseconds as the delta, right?

metan-ucw avatar Jan 03 '22 12:01 metan-ucw

Can we instead just get the clock resolution and base the delta on that? We can call clock_getres() for the CLOCK_REALTIME_COARSE and if that succeeds we can use the tv_nsec rounded up to to miliseconds as the delta, right?

I don't think it needs to be very complicated. At present, the minimum frequency is 100Hz, so 11ms can meet the requirements. The detal does not require high accuracy.

jiaoff avatar Jan 04 '22 08:01 jiaoff

I don't think it needs to be very complicated. At present, the minimum frequency is 100Hz, so 11ms can meet the requirements. The detal does not require high accuracy.

AFAIK, clock_gettime04 hit a kernel bug on s390 because li wang found a higher value ie 8. So I think cyril's advise is meaningful. See the following url clock_gettime04: print more info to help debugging clock_gettime04: add linux-git commmit in tst_tag

xuyang0410 avatar Jan 04 '22 08:01 xuyang0410

Exactly as @xuyang0410 wrote these tests are trying to assert timer precision, the delta has to be as small as possible.

metan-ucw avatar Jan 04 '22 10:01 metan-ucw

Exactly as @xuyang0410 wrote these tests are trying to assert timer precision, the delta has to be as small as possible.

can you get the clock resolution?I didn't find the relevant interface.

jiaoff avatar Jan 25 '22 06:01 jiaoff

@jiaoff Maybe use tst_config_get api to parse the CONFIG_HZ value?

xuyang0410 avatar Jan 25 '22 07:01 xuyang0410

@jiaoff What about clock_getres()?

metan-ucw avatar Jan 25 '22 15:01 metan-ucw

We split the delta into the precise and coarse parts via https://github.com/linux-test-project/ltp/commit/9851deb86ef257a98d7433280161d8ca685aa669

I think this problem has been resolved, at least with no report from our testing for quite a long time.

wangli5665 avatar Oct 27 '22 02:10 wangli5665