armv6/legacy: optimize cpu_getcount performance

Use nanotime instread of binuptime.
This change is for old and legacy platforms and does not impact any armv7 and later.
Might be MFCed to 13.0 once armv6 support is finally dropped in 14.0

Sponsored by:		Stormshield
Reviewed by:		mw
Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D33719
This commit is contained in:
Wojciech Macek 2022-03-14 07:51:21 +01:00
parent 1d33307434
commit 25bcd81b8d

View File

@ -40,11 +40,11 @@ get_cyclecount(void)
} else
#endif
return cp15_pmccntr_get();
#else /* No performance counters, so use binuptime(9). This is slooooow */
struct bintime bt;
#else /* No performance counters, so use nanotime(9). */
struct timespec tv;
binuptime(&bt);
return ((uint64_t)bt.sec << 56 | bt.frac >> 8);
nanotime(&tv);
return (tv.tv_sec * (uint64_t)1000000000ull + tv.tv_nsec);
#endif
}
#endif