Files
linux-kernel-module-cheat/userland/cpp/thread_hardware_concurrency.cpp
Ciro Santilli 六四事件 法轮功 d205140557 userland: move some multithreaded examples from cpp-cheat
Using them mostly to evaluate how well the emulators are handling user
mode multithreading.
2019-07-19 00:00:03 +00:00

11 lines
363 B
C++

// http://stackoverflow.com/questions/150355/programmatically-find-the-number-of-cores-on-a-machine
//
// Not affected by taskset: https://stackoverflow.com/questions/1006289/how-to-find-out-the-number-of-cpus-using-python/55423170#55423170
#include <iostream>
#include <thread>
int main() {
std::cout << std::thread::hardware_concurrency() << std::endl;
}