<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 4, 2022 at 11:44 PM Martin Doucha <<a href="mailto:mdoucha@suse.cz">mdoucha@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 04. 11. 22 15:20, Andrea Cervesato wrote:<br>
> Hi!<br>
> <br>
> On 11/4/22 13:46, Martin Doucha wrote:<br>
>> This approach looks like it'll lead to some bad edge cases when<br>
>> 0 < time_step < 1000. It'd be better to keep the original time_step <br>
>> detection and initialize "error" variable like this (and also rename <br>
>> it to "margin"):<br>
>><br>
>> int jiffy;<br>
>><br>
>> verify_setitimer()<br>
>> {<br>
>>     ...<br>
>>     margin = (tc->which == ITIMER_REAL) ? 0 : jiffy;<br>
> Here we can't take in consideration CLOCK_MONOTONIC_COARSE resolution by <br>
> default, because on ITIMER_REAL we are having a clock resolution given <br>
> by CLOCK_MONOTONIC. And unfortunately we are not sure it's under the <br>
> millisecond resolution all the times, which means margin > 0. For this <br>
> reason, in the patch we are fetching clock resolution in a different <br>
> way, according with the counter timer. We can fetch different <br>
> resolutions from setup tho and using inside the test code.<br>
<br>
There is nothing preventing you from using CLOCK_MONOTONIC_COARSE <br>
resolution as time_step even for ITIMER_REAL. The only constraints are <br>
that the timer value must be:<br>
1) higher than CLOCK_MONOTONIC resolution (preferably a multiple of it)</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
2) large enough so that you can call setitimer() again before the timer <br>
expires</blockquote></div><div class="gmail_default" style="font-size:small"></div><div><div class="gmail_default" style="font-size:small">Just finding a proper size should be fine, because next I plan to</div><div class="gmail_default" style="font-size:small">split ovalue check from the signal test. That means we can give both</div><div class="gmail_default" style="font-size:small">SEC and USEC for setitimer() verification.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Also, the interval timer should be tested as well, it will be rebased</div><div class="gmail_default" style="font-size:small">(on this problem fixing) in a separate patch.</div></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>