comparison 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
comparison
equal deleted inserted replaced
17923:a062c3691003 17924:917873d2983d
56 static void check_signal_handler(int sig); 56 static void check_signal_handler(int sig);
57 57
58 // For signal flags diagnostics 58 // For signal flags diagnostics
59 static int sigflags[MAXSIGNUM]; 59 static int sigflags[MAXSIGNUM];
60 60
61 #ifdef __APPLE__
62 // mach_absolute_time
63 static mach_timebase_info_data_t _timebase_info;
64 static volatile uint64_t _max_abstime;
65 #else
61 static int (*_clock_gettime)(clockid_t, struct timespec *); 66 static int (*_clock_gettime)(clockid_t, struct timespec *);
67 #endif
62 68
63 static GrowableArray<int>* _cpu_to_node; 69 static GrowableArray<int>* _cpu_to_node;
64 70
65 protected: 71 protected:
66 72
133 139
134 // Real-time clock functions 140 // Real-time clock functions
135 static void clock_init(void); 141 static void clock_init(void);
136 142
137 static inline bool supports_monotonic_clock() { 143 static inline bool supports_monotonic_clock() {
144 #ifdef __APPLE__
145 return true;
146 #else
138 return _clock_gettime != NULL; 147 return _clock_gettime != NULL;
139 } 148 #endif
140
141 static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
142 return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
143 } 149 }
144 150
145 // Stack repair handling 151 // Stack repair handling
146 152
147 // none present 153 // none present