Skip to content

Instantly share code, notes, and snippets.

@andrei512
Last active December 18, 2015 17:49
Show Gist options
  • Save andrei512/5821265 to your computer and use it in GitHub Desktop.
Save andrei512/5821265 to your computer and use it in GitHub Desktop.
Count the number of cores on iOS
#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