diff options
author | phk <phk@FreeBSD.org> | 2003-02-05 08:55:10 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-02-05 08:55:10 +0000 |
commit | 9a0e9d814a7d41ed5c13b7c5c74f47eef9791b9c (patch) | |
tree | 11b7a81de29ea96b5c821cc14692d524bb5488ef /sys/i386 | |
parent | 0b7392dfc18e9b43f895c2c6415e191633ea0107 (diff) | |
download | FreeBSD-src-9a0e9d814a7d41ed5c13b7c5c74f47eef9791b9c.zip FreeBSD-src-9a0e9d814a7d41ed5c13b7c5c74f47eef9791b9c.tar.gz |
Make get_cyclecount() use binuptime() when no tsc is available: it is cheaper.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/include/cpu.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index 06c191b..d4e72bb 100644 --- a/sys/i386/include/cpu.h +++ b/sys/i386/include/cpu.h @@ -94,17 +94,17 @@ void fork_trampoline(void); /* * Return contents of in-cpu fast counter as a sort of "bogo-time" - * for non-critical timing. + * for random-harvesting purposes. */ static __inline u_int64_t get_cyclecount(void) { #if defined(I386_CPU) || defined(I486_CPU) - struct timespec tv; + struct bintime bt; if (!tsc_present) { - nanotime(&tv); - return (tv.tv_sec * (u_int64_t)1000000000 + tv.tv_nsec); + binuptime(&bt); + return (bt.frac ^ bt.sec); } #endif return (rdtsc()); |