bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

clock_getcpuclockid versus clock-time


From: Andy Wingo
Subject: clock_getcpuclockid versus clock-time
Date: Fri, 17 Jun 2011 11:15:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Hello gnulibbers,

I have a curious issue.  I would like to use clock_gettime with
CLOCK_PROCESS_CPUTIME_ID.  clock_gettime(2) notes some portability
issues with this timer, suggesting that the user call
clock_getcpuclockid(0) to verify that the timer is available.

I was using the clock-time module, but it turns out that on uclibc,
clock_gettime is available in libc, but clock_getcpuclockid is only
available in librt.  Thus the clock-time check doesn't add -lrt.

Here's a note from a user.  The quoted text is mine.

    > Is it perhaps that clock_getcpuclockid is in -lrt but clock_gettime is
    > in your libc?

    clock_gettime is in both of them:

    /lib # readelf -s librt.so.0 | grep clock
        42: 00001cb4    68 FUNC    GLOBAL DEFAULT    6 clock_gettime
        44: 00001a78   172 FUNC    GLOBAL DEFAULT    6 clock_nanosleep
        64: 00001b74    88 FUNC    GLOBAL DEFAULT    6 clock_getcpuclockid
    /lib # readelf -s libc.so.0 | grep clock
       166: 0000fcf4    72 FUNC    GLOBAL DEFAULT    6 clock_gettime
       514: 00011868    72 FUNC    GLOBAL DEFAULT    6 clock_settime
       537: 0000fa84    72 FUNC    GLOBAL DEFAULT    6 clock_getres
       762: 0002a588    56 FUNC    GLOBAL DEFAULT    6 clock

    but getcpuclockid is only in librt.

I "solved" this issue with a patch like the attached (to a locally
included gl_CLOCK_TIME).  What do you think is the right thing to do
here?

Thanks,

Andy

Attachment: 0001-check-for-clock_getcpuclockid-in-gl_CLOCK_TIME.patch
Description: Text Data

-- 
http://wingolog.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]