about summary refs log tree commit diff
path: root/absl/base/internal/cycleclock.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/base/internal/cycleclock.h')
-rw-r--r--absl/base/internal/cycleclock.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/absl/base/internal/cycleclock.h b/absl/base/internal/cycleclock.h
index 60e971583c57..9853a66cefa6 100644
--- a/absl/base/internal/cycleclock.h
+++ b/absl/base/internal/cycleclock.h
@@ -71,6 +71,20 @@ class CycleClock {
   CycleClock& operator=(const CycleClock&) = delete;
 };
 
+using CycleClockSourceFunc = int64_t (*)();
+
+class CycleClockSource {
+ private:
+  // CycleClockSource::Register()
+  //
+  // Register a function that provides an alternate source for the unscaled CPU
+  // cycle count value. The source function must be async signal safe, must not
+  // call CycleClock::Now(), and must have a frequency that matches that of the
+  // unscaled clock used by CycleClock. A nullptr value resets CycleClock to use
+  // the default source.
+  static void Register(CycleClockSourceFunc source);
+};
+
 }  // namespace base_internal
 }  // namespace absl