diff options
author | neel <neel@FreeBSD.org> | 2013-01-25 06:27:03 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2013-01-25 06:27:03 +0000 |
commit | 069e512501152988573a86950660e4d3a38678b5 (patch) | |
tree | 2828fc980f3ec0529709091047123d2cfae49672 /usr.sbin/bhyve | |
parent | 7c6cedfc5960cf37c1945687db87c260055ee755 (diff) | |
download | FreeBSD-src-069e512501152988573a86950660e4d3a38678b5.zip FreeBSD-src-069e512501152988573a86950660e4d3a38678b5.tar.gz |
Use the correct type (uint64_t) to retrieve sysctl machdep.tsc_freq.
Simplify the function a bit by falling through after initialization and
return via the normal code path.
Reviewed by: grehan
Obtained from: NetApp
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r-- | usr.sbin/bhyve/pmtmr.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.sbin/bhyve/pmtmr.c b/usr.sbin/bhyve/pmtmr.c index 78d14eb..b85b0a7 100644 --- a/usr.sbin/bhyve/pmtmr.c +++ b/usr.sbin/bhyve/pmtmr.c @@ -66,17 +66,14 @@ pmtmr_val(void) if (!inited) { size_t len; - uint32_t tmpf; inited = 1; pthread_mutex_init(&pmtmr_mtx, NULL); - len = sizeof(tmpf); - sysctlbyname("machdep.tsc_freq", &tmpf, &len, + len = sizeof(pmtmr_tscf); + sysctlbyname("machdep.tsc_freq", &pmtmr_tscf, &len, NULL, 0); - pmtmr_tscf = tmpf; pmtmr_tsc_old = rdtsc(); pmtmr_old = pmtmr_tsc_old / pmtmr_tscf * PMTMR_FREQ; - return (pmtmr_old); } pthread_mutex_lock(&pmtmr_mtx); |