[PATCH] Update HP_TIMING_NOW for _ISOMAC in sysdeps/generic/hp-timing.h
H.J. Lu
hjl.tools@gmail.com
Thu May 28 14:50:42 GMT 2020
On Thu, May 28, 2020 at 7:29 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > On Thu, May 28, 2020 at 5:58 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu via Libc-alpha:
> >>
> >> > diff --git a/sysdeps/generic/hp-timing.h b/sysdeps/generic/hp-timing.h
> >> > index af9d92f7f7..99b12995f1 100644
> >> > --- a/sysdeps/generic/hp-timing.h
> >> > +++ b/sysdeps/generic/hp-timing.h
> >> > @@ -24,6 +24,11 @@
> >> > #include <stdint.h>
> >> > #include <hp-timing-common.h>
> >> >
> >> > +#ifdef _ISOMAC
> >> > +# define __timespec64 timespec
> >> > +# define __clock_gettime64 clock_gettime
> >> > +#endif
> >> > +
> >> > /* It should not be used for ld.so. */
> >> > #define HP_TIMING_INLINE (0)
> >>
> >> To be honest, I would have expected different definitions of the timing
> >> macros. This redirection looks a bit iffy for me for _ISOMAC.
> >
> > What do you have in mind?
>
> Something like this:
>
> /* The clock_gettime (CLOCK_MONOTONIC) has unspecified starting time,
> nano-second accuracy, and for some architectues is implemented as
> vDSO symbol. */
> #ifdef _ISOMAC
> # define HP_TIMING_NOW(var) \
> ({ \
> struct timespec tv; \
> clock_gettime (CLOCK_MONOTONIC, &tv); \
> (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); \
> })
> #else
> # define HP_TIMING_NOW(var) \
> ({ \
> struct __timespec64 tv; \
> __clock_gettime64 (CLOCK_MONOTONIC, &tv); \
> (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); \
> })
> #endif
>
> in sysdeps/generic/hp-timing.h.
>
Here is the updated patch. OK for master?
Thanks.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Update-HP_TIMING_NOW-for-_ISOMAC-in-sysdeps-generic-.patch
Type: text/x-patch
Size: 2468 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200528/8d7f780e/attachment-0001.bin>
More information about the Libc-alpha
mailing list