(svn r23481) -Add: Function to get the CPU core count.

This commit is contained in:
michi_cc
2011-12-10 16:54:41 +00:00
parent c3440658e8
commit 62ea921e2f
5 changed files with 67 additions and 0 deletions

View File

@@ -172,3 +172,20 @@ bool GetClipboardContents(char *buffer, size_t buff_len)
return true;
}
#endif
uint GetCPUCoreCount()
{
uint count = 1;
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (MacOSVersionIsAtLeast(10, 5, 0)) {
count = [ [ NSProcessInfo processInfo ] activeProcessorCount ];
} else
#endif
{
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
count = MPProcessorsScheduled();
#endif
}
return count;
}