[Piglit] [PATCH] cmake: Detect if system has POSIX clocks

Ian Romanick idr at freedesktop.org
Thu Oct 17 00:55:58 CEST 2013


On 10/16/2013 09:55 AM, Jordan Justen wrote:
> On Wed, Oct 16, 2013 at 9:24 AM, Ian Romanick <idr at freedesktop.org> wrote:
>> On 10/14/2013 04:37 PM, Jordan Justen wrote:
>>> Chad,
>>>
>>> I wanted a similar feature, but I was also thinking of adding a
>>> piglit-util function (piglit_get_microseconds). I think it should be
>>> easy to port this function to windows.
>>>
>>> I also had the cmake parts a little different, but I don't really have
>>> a preference on that.
>>>
>>> http://cgit.freedesktop.org/~jljusten/piglit/commit/?id=d1a9c3fb
>>
>> I'd rather use a POSIX function and provide an implementation of that
>> function on platforms that don't already support it.  We already do that
>> for a number of C99 functions.
> 
> Would you consider clock_gettime a POSIX function?
> 
> My proposed piglit_get_microseconds function uses that. (I posted this
> patch yesterday as
> 03/10 piglit-util: add piglit_get_microseconds.)
> 
> Although, according to:
> http://www.tin.org/bin/man.cgi?section=3&topic=clock_gettime
> perhaps I should be making sure _POSIX_TIMERS and
> _POSIX_MONOTONIC_CLOCK are defined.
> 
> Or, is your feedback that we should use the clock_gettime function as
> the interface rather than adding piglit_get_microseconds? In that
> case, my thought is that the simple wrapper function would make it
> somewhat less cumbersome than dealing with the struct. (simple
> uint64_t vs. 2 fields in a struct)

Riiiight.  I always forget how annoying the interfaces are in the POSIX
time functions.  piglit_get_microseconds isn't just a portability
wrapper around clock_gettime, it provides a different interface.
Correct?  I'm fine with that.

I do agree with Chad's comment about the implementation of
piglit_get_microseconds.  I'll reply there too.

> -Jordan



More information about the Piglit mailing list