mirror of
https://github.com/nillerusr/source-engine.git
synced 2025-01-03 14:06:44 +00:00
tier0: fix cpu freq on some arm cpu's
This commit is contained in:
parent
8200eda3ec
commit
79e83bb97f
@ -100,13 +100,13 @@ uint64 GetCPUFreqFromPROC()
|
|||||||
uint64 CalculateCPUFreq()
|
uint64 CalculateCPUFreq()
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
uint64 freq_hz = 0;
|
uint64 freq_hz = 0;
|
||||||
size_t freq_size = sizeof(freq_hz);
|
size_t freq_size = sizeof(freq_hz);
|
||||||
int retval = sysctlbyname("hw.cpufrequency_max", &freq_hz, &freq_size, NULL, 0);
|
int retval = sysctlbyname("hw.cpufrequency_max", &freq_hz, &freq_size, NULL, 0);
|
||||||
// MoeMod : TODO dont know how to get freq on Apple Silicon
|
// MoeMod : TODO dont know how to get freq on Apple Silicon
|
||||||
if(!freq_hz)
|
if(!freq_hz)
|
||||||
freq_hz = 3200000000;
|
freq_hz = 3200000000;
|
||||||
return freq_hz;
|
return freq_hz;
|
||||||
#else
|
#else
|
||||||
// Try to open cpuinfo_max_freq. If the kernel was built with cpu scaling support disabled, this will fail.
|
// Try to open cpuinfo_max_freq. If the kernel was built with cpu scaling support disabled, this will fail.
|
||||||
FILE *fp = fopen( "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", "r" );
|
FILE *fp = fopen( "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", "r" );
|
||||||
@ -161,12 +161,12 @@ uint64 CalculateCPUFreq()
|
|||||||
|
|
||||||
period1 = period2;
|
period1 = period2;
|
||||||
period2 = period3;
|
period2 = period3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( count == max_iterations )
|
if ( count == max_iterations )
|
||||||
{
|
{
|
||||||
return GetCPUFreqFromPROC(); // fall back to /proc
|
return GetCPUFreqFromPROC(); // fall back to /proc
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the period to the average period measured.
|
// Set the period to the average period measured.
|
||||||
period = ( period1 + period2 + period3 ) / 3;
|
period = ( period1 + period2 + period3 ) / 3;
|
||||||
@ -180,6 +180,6 @@ uint64 CalculateCPUFreq()
|
|||||||
|
|
||||||
return period;
|
return period;
|
||||||
#endif
|
#endif
|
||||||
return (uint64)0;
|
return (uint64)2000000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
wscript
9
wscript
@ -271,12 +271,9 @@ def configure(conf):
|
|||||||
if conf.options.OPUS or conf.env.DEST_OS == 'android':
|
if conf.options.OPUS or conf.env.DEST_OS == 'android':
|
||||||
projects['game'] += ['engine/voice_codecs/opus']
|
projects['game'] += ['engine/voice_codecs/opus']
|
||||||
|
|
||||||
if conf.env.DEST_OS in ['win32', 'linux', 'darwin'] and conf.env.DEST_CPU in ['x86_64', 'amd64']:
|
conf.env.BIT32_MANDATORY = not conf.options.ALLOW64
|
||||||
conf.env.BIT32_MANDATORY = not conf.options.ALLOW64
|
if conf.env.BIT32_MANDATORY:
|
||||||
if conf.env.BIT32_MANDATORY:
|
Logs.info('WARNING: will build engine for 32-bit target')
|
||||||
Logs.info('WARNING: will build engine for 32-bit target')
|
|
||||||
else:
|
|
||||||
conf.env.BIT32_MANDATORY = False
|
|
||||||
|
|
||||||
conf.load('force_32bit')
|
conf.load('force_32bit')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user