获取设备信息

1.获取设备的cpu核心数

unsigned int countOfCores() {
  unsigned int ncpu;
  size_t len = sizeof(ncpu);
  sysctlbyname("hw.ncpu", &ncpu, &len, NULL, 0);
  return ncpu;
}

参考链接:http://blog.csdn.net/qiwancong/article/details/7914923

你可能感兴趣的:(获取设备信息)