src/os/bsd/vm/os_bsd.hpp

Print this page
rev 6280 : 8040140: System.nanoTime() is slow and non-monotonic on OS X
6864866: add a flag to use result of gethrtime() directly in os::getTimeNanos() on Solaris
Reviewed-by: sspitsyn, shade, dholmes

@@ -56,11 +56,17 @@
   static void check_signal_handler(int sig);
 
   // 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;
 
  protected:
 

@@ -132,14 +138,10 @@
   static size_t default_guard_size(os::ThreadType thr_type);
 
   // Real-time clock functions
   static void clock_init(void);
 
-  static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
-    return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
-  }
-
   // Stack repair handling
 
   // none present
 
   // BsdThreads work-around for 6292965