summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/cpu.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-02-05 08:55:10 +0000
committerphk <phk@FreeBSD.org>2003-02-05 08:55:10 +0000
commit9a0e9d814a7d41ed5c13b7c5c74f47eef9791b9c (patch)
tree11b7a81de29ea96b5c821cc14692d524bb5488ef /sys/amd64/include/cpu.h
parent0b7392dfc18e9b43f895c2c6415e191633ea0107 (diff)
downloadFreeBSD-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/amd64/include/cpu.h')
-rw-r--r--sys/amd64/include/cpu.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h
index 06c191b..d4e72bb 100644
--- a/sys/amd64/include/cpu.h
+++ b/sys/amd64/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());
OpenPOWER on IntegriCloud