diff options
author | jkim <jkim@FreeBSD.org> | 2011-03-15 17:14:26 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2011-03-15 17:14:26 +0000 |
commit | d3440080b0bc9de31def1f395728bafd1bcb558f (patch) | |
tree | 9f889ab1934474ce79827222d5447c8d15cf1966 | |
parent | df0279499fdce5dd28c2af86898e4b9c83687638 (diff) | |
download | FreeBSD-src-d3440080b0bc9de31def1f395728bafd1bcb558f.zip FreeBSD-src-d3440080b0bc9de31def1f395728bafd1bcb558f.tar.gz |
Unconditionally use binuptime(9) for get_cyclecount(9) on i386. Since this
function is almost exclusively used for random harvesting, there is no need
for micro-optimization. Adjust the manual page accordingly.
-rw-r--r-- | share/man/man9/get_cyclecount.9 | 8 | ||||
-rw-r--r-- | sys/i386/include/cpu.h | 9 |
2 files changed, 6 insertions, 11 deletions
diff --git a/share/man/man9/get_cyclecount.9 b/share/man/man9/get_cyclecount.9 index e3be78e..470b7be 100644 --- a/share/man/man9/get_cyclecount.9 +++ b/share/man/man9/get_cyclecount.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2009 +.Dd March 15, 2011 .Dt GET_CYCLECOUNT 9 .Os .Sh NAME @@ -65,14 +65,14 @@ do not have such a register, so .Fn get_cyclecount on these platforms -returns a (non-monotonic) combination of numbers +returns a (monotonic) combination of numbers represented by the structure returned by .Xr binuptime 9 . .Pp The -.Tn Pentium -processors all use the +.Tn AMD64 and Intel 64 +processors use the .Li TSC register. .Pp diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index bee0b5f..7ceb196 100644 --- a/sys/i386/include/cpu.h +++ b/sys/i386/include/cpu.h @@ -70,15 +70,10 @@ void swi_vm(void *); static __inline uint64_t get_cyclecount(void) { -#if defined(I486_CPU) || defined(KLD_MODULE) struct bintime bt; - if (!tsc_present) { - binuptime(&bt); - return ((uint64_t)bt.sec << 56 | bt.frac >> 8); - } -#endif - return (rdtsc()); + binuptime(&bt); + return ((uint64_t)bt.sec << 56 | bt.frac >> 8); } #endif |