forked from 0ad/0ad
janwas
623e649acb
all cpu-related stuff is now defined in cpu.h (with cpu_ prefix and fully encapsulated). fix quite brittle core/HT unit/package detection. implement mkdir on VC8, where it is deprecated add strdup on MacOSX move ia32 code into separate subdir. functions implemented in asm are called ia32_asm_*. add some unix versions of sysdep functions (cannot test them) timer: fix for amd64 linux This was SVN commit r4995.
53 lines
801 B
C++
53 lines
801 B
C++
#include "precompiled.h"
|
|
|
|
#include "ucpu.h"
|
|
|
|
int ucpu_isThrottlingPossible()
|
|
{
|
|
return -1; // don't know
|
|
}
|
|
|
|
int ucpu_numPackages()
|
|
{
|
|
long res = sysconf(_SC_NPROCESSORS_CONF);
|
|
if (res == -1)
|
|
return 1;
|
|
else
|
|
return (int)res;
|
|
}
|
|
|
|
double ucpu_clockFrequency()
|
|
{
|
|
return -1; // don't know
|
|
}
|
|
|
|
|
|
// apparently not possible on non-Windows OSes because they seem to lack
|
|
// a CPU affinity API. see sysdep.h comment.
|
|
LibError ucpu_callByEachCPU(CpuCallback cb, void* param)
|
|
{
|
|
UNUSED2(cb);
|
|
|
|
/*
|
|
cpu_set_t currentCPU;
|
|
|
|
while ( j < sysNumProcs )
|
|
|
|
{
|
|
|
|
CPU_ZERO(¤tCPU);
|
|
|
|
CPU_SET(j, ¤tCPU);
|
|
|
|
if ( sched_setaffinity (0, sizeof (currentCPU), ¤tCPU)
|
|
|
|
== 0 )
|
|
|
|
{
|
|
|
|
sleep(0); // Ensure system to switch to the right
|
|
*/
|
|
|
|
return ERR::NO_SYS;
|
|
}
|