MCPcopy Create free account
hub / github.com/apache/arrow / GetNumAffinityCores

Function GetNumAffinityCores

cpp/src/arrow/util/io_util.cc:2245–2259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2243}
2244
2245Result<int32_t> GetNumAffinityCores() {
2246#if defined(__linux__)
2247 cpu_set_t mask;
2248 if (sched_getaffinity(0, sizeof(mask), &mask) == 0) {
2249 auto count = CPU_COUNT(&mask);
2250 if (count > 0 &&
2251 static_cast<uint64_t>(count) < std::numeric_limits<uint32_t>::max()) {
2252 return static_cast<uint32_t>(count);
2253 }
2254 }
2255 return IOErrorFromErrno(errno, "Could not read the CPU affinity.");
2256#else
2257 return Status::NotImplemented("Only implemented for Linux");
2258#endif
2259}
2260
2261Result<void*> LoadDynamicLibrary(const char* path) {
2262#ifdef _WIN32

Callers 2

TESTFunction · 0.85
DefaultCapacityMethod · 0.85

Calls 2

IOErrorFromErrnoFunction · 0.85
NotImplementedFunction · 0.50

Tested by 1

TESTFunction · 0.68