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

Chad Versace chad.versace at linux.intel.com
Thu Oct 17 00:47:05 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?

It *is* a POSIX function, defined by SUSv2 and POSIX.1-2001.

> 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)

I'm not opposed to a simple wrapper around clock_gettime(). However, I'd
like to see such a wrapper implemented on top of this patch.


More information about the Piglit mailing list