Make get_cyclecount() use binuptime() when no tsc is available: it is cheaper.

This commit is contained in:
Poul-Henning Kamp 2003-02-05 08:55:10 +00:00
parent 41abcc1b62
commit 553ebddc59
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=110368
2 changed files with 8 additions and 8 deletions

View File

@ -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());

View File

@ -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());