Mercurial > hg > truffle
diff src/os/bsd/vm/os_bsd.hpp @ 17924:917873d2983d
8040140: System.nanoTime() is slow and non-monotonic on OS X
Reviewed-by: sspitsyn, shade, dholmes, acorn
author | sla |
---|---|
date | Fri, 25 Apr 2014 07:40:33 +0200 |
parents | b0133e4187d3 |
children | 52b4284cb496 |
line wrap: on
line diff
--- a/src/os/bsd/vm/os_bsd.hpp Mon May 05 15:10:43 2014 +0200 +++ b/src/os/bsd/vm/os_bsd.hpp Fri Apr 25 07:40:33 2014 +0200 @@ -58,7 +58,13 @@ // For signal flags diagnostics static int sigflags[MAXSIGNUM]; +#ifdef __APPLE__ + // mach_absolute_time + static mach_timebase_info_data_t _timebase_info; + static volatile uint64_t _max_abstime; +#else static int (*_clock_gettime)(clockid_t, struct timespec *); +#endif static GrowableArray<int>* _cpu_to_node; @@ -135,11 +141,11 @@ static void clock_init(void); static inline bool supports_monotonic_clock() { +#ifdef __APPLE__ + return true; +#else return _clock_gettime != NULL; - } - - static int clock_gettime(clockid_t clock_id, struct timespec *tp) { - return _clock_gettime ? _clock_gettime(clock_id, tp) : -1; +#endif } // Stack repair handling