31 namespace base_internal {
33 #if ABSL_USE_UNSCALED_CYCLECLOCK 38 #ifdef ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY 42 static constexpr int32_t kShift = 1;
47 static constexpr int32_t kShift = 0;
52 static constexpr int32_t kShift = 2;
55 static constexpr
double kFrequencyScale = 1.0 / (1 << kShift);
56 static std::atomic<CycleClockSourceFunc> cycle_clock_source;
61 if (cycle_clock_source.load(std::memory_order_relaxed) ==
nullptr) {
68 return cycle_clock_source.load(std::memory_order_acquire);
74 auto fn = LoadCycleClockSource();
78 return fn() >> kShift;
82 return kFrequencyScale * base_internal::UnscaledCycleClock::Frequency();
87 cycle_clock_source.store(source, std::memory_order_release);
93 return std::chrono::duration_cast<std::chrono::nanoseconds>(
94 std::chrono::steady_clock::now().time_since_epoch())
int64_t(*)( CycleClockSourceFunc)
static double Frequency()
static void Register(CycleClockSourceFunc source)