Update comments on UnscaledCycleClock::Now.

Notably, this points out that armv8.6-a on is guaranteed to be 1GHz. This references https://developer.arm.com/documentation/102379/0101/What-is-the-Generic-Timer- as well.

PiperOrigin-RevId: 749912254
Change-Id: Ibc5a743d821a5dc9f5d3792629b7c3f1c01edff5
This commit is contained in:
Abseil Team
2025-04-21 14:05:30 -07:00
committed by Copybara-Service
parent 01228903e9
commit 8b2b78bb9b

View File

@@ -88,9 +88,14 @@ inline int64_t UnscaledCycleClock::Now() {
#elif defined(__aarch64__)
// System timer of ARMv8 runs at a different frequency than the CPU's.
// The frequency is fixed, typically in the range 1-50MHz. It can be
// read at CNTFRQ special register. We assume the OS has set up
// the virtual timer properly.
//
// Frequency is fixed. From Armv8.6-A and Armv9.1-A on, the frequency is 1GHz.
// Pre-Armv8.6-A, the frequency was a system design choice, typically in the
// range of 1MHz to 50MHz. See also:
// https://developer.arm.com/documentation/102379/0101/What-is-the-Generic-Timer-
//
// It can be read at CNTFRQ special register. We assume the OS has set up the
// virtual timer properly.
inline int64_t UnscaledCycleClock::Now() {
int64_t virtual_timer_value;
asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));