This source file includes following definitions.
- opal_timer_base_get_cycles
- opal_timer_base_get_usec
- opal_timer_base_get_freq
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 #ifndef OPAL_MCA_TIMER_DARWIN_TIMER_DARWIN_H
  20 #define OPAL_MCA_TIMER_DARWIN_TIMER_DARWIN_H
  21 
  22 #include "opal_config.h"
  23 #include <mach/mach_time.h>
  24 
  25 typedef uint64_t opal_timer_t;
  26 
  27 
  28 OPAL_DECLSPEC extern opal_timer_t opal_timer_darwin_freq;
  29 OPAL_DECLSPEC extern mach_timebase_info_data_t opal_timer_darwin_info;
  30 OPAL_DECLSPEC extern opal_timer_t opal_timer_darwin_bias;
  31 
  32 
  33 
  34 
  35 
  36 static inline opal_timer_t
  37 opal_timer_base_get_cycles(void)
  38 {
  39     uint64_t now = mach_absolute_time();
  40 
  41     if( opal_timer_darwin_info.denom == 0 ) {
  42         (void)mach_timebase_info(&opal_timer_darwin_info);
  43         if( opal_timer_darwin_info.denom > 1024 ) {
  44             double frac = (double)opal_timer_darwin_info.numer/opal_timer_darwin_info.denom;
  45             opal_timer_darwin_info.denom = 1024;
  46             opal_timer_darwin_info.numer = opal_timer_darwin_info.denom * frac + 0.5;
  47         }
  48         opal_timer_darwin_bias = now;
  49     }
  50     
  51 
  52     return (now - opal_timer_darwin_bias) * opal_timer_darwin_info.numer / opal_timer_darwin_info.denom;
  53 }
  54 
  55 
  56 static inline opal_timer_t
  57 opal_timer_base_get_usec(void)
  58 {
  59     
  60     return opal_timer_base_get_cycles() / 1000;
  61 }
  62 
  63 
  64 static inline opal_timer_t
  65 opal_timer_base_get_freq(void)
  66 {
  67     return opal_timer_darwin_freq;
  68 }
  69 
  70 
  71 #define OPAL_TIMER_CYCLE_NATIVE 0
  72 #define OPAL_TIMER_CYCLE_SUPPORTED 1
  73 #define OPAL_TIMER_USEC_NATIVE 1
  74 #define OPAL_TIMER_USEC_SUPPORTED 1
  75 
  76 #endif