[PATCH_v2] use CLOCK_MONOTONIC_COARSE posix timer instead of CLOCK_MONOTONIC in Xorg

ykzhao yakui.zhao at intel.com
Sat Aug 28 19:30:28 PDT 2010


On Fri, 2010-08-27 at 19:53 +0800, Daniel Stone wrote:
> On Fri, Aug 27, 2010 at 05:32:55PM +0800, ykzhao wrote:
> > On Fri, 2010-08-27 at 10:15 +0800, Daniel Stone wrote:
> > > Your patch, however, removes the check to make sure the monotonic clock
> > > is working.  
> > 
> > No. The CLOCK_MONOTONIC check is not removed. It is realized by using:
> >    >if (clock_gettime(clockid, &tp) == 0)
> >    If it fails, it will then call the function of gettimeofday.
> >    
> >    When the CLOCK_MONOTONIC_COARSE is not supported or the resolution of
> > timer is greater than 1ms, it will fall back to CLOCK_MONOTONIC. 
> > 
> > If you expect to do more check about CLOCK_MONOTONIC, Maybe we can add
> > another patch to check it. 
> 
> I should've replied to this part as well: your patch makes it no worse
> than currently, but it's still a regression compared to the suggested
> patch I posted a few days ago.  With your patch, if CLOCK_MONOTONIC is
> unsupported on the target, every call to GetTimeInMillis() will take two
> syscalls instead of one.  The patch I posted tests each one once, and
> thus only makes one syscall, assuming the clocks don't magically
> transition from working to not working.

I agree with the above analysis. 

Is it better that only one thing is done in one patch? Right?

In fact the main purpose in the V2 patch is only to use the
CLOCK_MONOTONIC_COARSE posix timer instead of CLOCK_MONOTONIC in xorg.

If we also expect to add more check about CLOCK_MONOTONIC posix timer,
we can write another patch.  

Thanks.
    Yakui

> 
> Cheers,
> Daniel



More information about the xorg-devel mailing list