56 topo.
cpu_count =
static_cast<int>(std::thread::hardware_concurrency());
70 std::string path =
"/sys/devices/system/node/node" + std::to_string(nodes);
71 if (access(path.c_str(), F_OK) != 0)
80 for (
int nodeIndex = 0; nodeIndex < nodes; ++nodeIndex)
82 std::string list_path =
"/sys/devices/system/node/node" + std::to_string(nodeIndex) +
"/cpulist";
83 std::ifstream in(list_path);
95 while (i < s.size() && (std::isdigit(
static_cast<unsigned char>(s[i])) != 0))
98 startCpu = startCpu * 10 + (s[i] -
'0');
106 if (i < s.size() && s[i] ==
'-')
111 while (i < s.size() && (std::isdigit(
static_cast<unsigned char>(s[i])) != 0))
114 endCpu = endCpu * 10 + (s[i] -
'0');
117 if (gotb && endCpu >= startCpu)
119 for (
int cpuIndex = startCpu; cpuIndex <= endCpu; ++cpuIndex)
127 if (i < s.size() && s[i] ==
',')