MCPcopy Create free account
hub / github.com/Niko1221/Strata / cpu_numa_node

Function cpu_numa_node

engine/src/kernels/cpu/pool.cpp:677–686  ·  view source on GitHub ↗

The NUMA node of a logical CPU (sysfs), or -1.

Source from the content-addressed store, hash-verified

675
676// The NUMA node of a logical CPU (sysfs), or -1.
677int cpu_numa_node(int cpu) {
678 if (cpu < 0) return -1;
679 const std::string root = sysfs_root();
680 char path[512];
681 for (int node = 0; node < 64; ++node) {
682 std::snprintf(path, sizeof path, "%s/devices/system/cpu/cpu%d/node%d", root.c_str(), cpu, node);
683 if (access(path, F_OK) == 0) return node;
684 }
685 return -1;
686}
687#endif
688
689// The NUMA nodes with CPUs this machine has (0.2.2: the split is tried by itself from 2 on). Linux: the sysfs node folder

Callers 1

ExpertPoolMethod · 0.70

Calls 1

sysfs_rootFunction · 0.70

Tested by

no test coverage detected