mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-08 11:14:03 +08:00
Get CPU cores
This commit is contained in:
parent
6831cfaede
commit
eac38ffc4a
@ -1117,3 +1117,21 @@ chsrc_get_cpuarch ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
chsrc_get_cpucore ()
|
||||||
|
{
|
||||||
|
int cores = 2;
|
||||||
|
|
||||||
|
#if XY_On_Windows
|
||||||
|
SYSTEM_INFO info;
|
||||||
|
GetSystemInfo (&info);
|
||||||
|
DWORD num = sysinfo.dwNumberOfProcessors
|
||||||
|
cores = (int)num;
|
||||||
|
#else
|
||||||
|
long num = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
cores = (int)num;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return cores;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user