Last active
December 18, 2015 17:49
-
-
Save andrei512/5821265 to your computer and use it in GitHub Desktop.
Count the number of cores on iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mach/mach_host.h> | |
unsigned int countCores() | |
{ | |
host_basic_info_data_t hostInfo; | |
mach_msg_type_number_t infoCount; | |
infoCount = HOST_BASIC_INFO_COUNT; | |
host_info(mach_host_self(), HOST_BASIC_INFO, | |
(host_info_t)&hostInfo, &infoCount); | |
return (unsigned int)(hostInfo.max_cpus); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment