diff options
author | Jun Tang <juntangc@amazon.com> | 2023-02-22 16:45:59 +0000 |
---|---|---|
committer | Wilco Dijkstra <wilco.dijkstra@arm.com> | 2023-02-22 16:45:59 +0000 |
commit | 311a7e0256975275d97077f1af338bc9caf0c837 (patch) | |
tree | c844afe92c022f1e50e2c1052233cb72ae0d0b94 /sysdeps/aarch64 | |
parent | 8b014a1b1f7aee1e3348db108aeea396359d481e (diff) | |
download | glibc-311a7e0256975275d97077f1af338bc9caf0c837.tar.gz glibc-311a7e0256975275d97077f1af338bc9caf0c837.tar.xz glibc-311a7e0256975275d97077f1af338bc9caf0c837.zip |
AArch64: Fix HP_TIMING_DIFF computation [BZ# 29329]
Fix the computation to allow for cntfrq_el0 being larger than 1GHz. Assume cntfrq_el0 is a multiple of 1MHz to increase the maximum interval (1024 seconds at 1GHz). Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Diffstat (limited to 'sysdeps/aarch64')
-rw-r--r-- | sysdeps/aarch64/hp-timing.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/aarch64/hp-timing.h b/sysdeps/aarch64/hp-timing.h index c8469e3011..b97e878f7b 100644 --- a/sysdeps/aarch64/hp-timing.h +++ b/sysdeps/aarch64/hp-timing.h @@ -41,7 +41,7 @@ typedef uint64_t hp_timing_t; #define HP_TIMING_DIFF(Diff, Start, End) \ ({ hp_timing_t freq; \ __asm__ __volatile__ ("mrs %0, cntfrq_el0" : "=r" (freq)); \ - (Diff) = ((End) - (Start)) * (UINT64_C(1000000000) / freq); \ + (Diff) = (((End) - (Start)) * UINT64_C(1000000000 >> 6)) / (freq >> 6); \ }) #endif /* hp-timing.h */ |