We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a4faae commit 34cf741Copy full SHA for 34cf741
tests/unit/test_svs_tiered.cpp
@@ -31,11 +31,13 @@
31
// Returns the number of logical processors on the process
32
// Returns std::thread::hardware_concurrency() if the number of logical processors is not available
33
static unsigned int getAvailableCPUs() {
34
+#ifdef __linux__
35
// On Linux, use sched_getaffinity to get the number of CPUs available to the current process.
36
cpu_set_t cpu_set;
37
if (sched_getaffinity(0, sizeof(cpu_set), &cpu_set) == 0) {
38
return CPU_COUNT(&cpu_set);
39
}
40
+#endif
41
// Fallback.
42
return std::thread::hardware_concurrency();
43
0 commit comments