デバイス情報を取得
259 ワード
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