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

Jordan Justen jljusten at gmail.com
Wed Oct 16 18:55:31 CEST 2013


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)

-Jordan


More information about the Piglit mailing list