mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-22 18:30:27 +01:00
Determine CPU speed on FreeBSD
This commit is contained in:
parent
b299789db5
commit
0e672b866e
|
@ -37,6 +37,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PLATFORM_FREEBSD
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Read the Pentium TimeStampCounter (or something like that).
|
// Read the Pentium TimeStampCounter (or something like that).
|
||||||
static inline __int64 ReadTSC(void)
|
static inline __int64 ReadTSC(void)
|
||||||
{
|
{
|
||||||
|
@ -340,6 +345,13 @@ CTimer::CTimer(BOOL bInterrupt /*=TRUE*/)
|
||||||
#elif PLATFORM_MACOSX
|
#elif PLATFORM_MACOSX
|
||||||
tm_llPerformanceCounterFrequency = tm_llCPUSpeedHZ = ((__int64) GetCPUSpeed()) * 1000000;
|
tm_llPerformanceCounterFrequency = tm_llCPUSpeedHZ = ((__int64) GetCPUSpeed()) * 1000000;
|
||||||
|
|
||||||
|
#elif PLATFORM_FREEBSD
|
||||||
|
__int64 mhz = 0;
|
||||||
|
size_t len = sizeof(mhz);
|
||||||
|
|
||||||
|
sysctlbyname("hw.clockrate", &mhz, &len, NULL, 0);
|
||||||
|
tm_llPerformanceCounterFrequency = tm_llCPUSpeedHZ = (__int64) (mhz * 1000000);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// !!! FIXME : This is an ugly hack.
|
// !!! FIXME : This is an ugly hack.
|
||||||
double mhz = 0.0;
|
double mhz = 0.0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user