Created
March 20, 2015 08:49
-
-
Save rongyi/3fbbd112e7798039cd8c to your computer and use it in GitHub Desktop.
two ways to get cpu cores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <thread> | |
#include <iostream> | |
#include <unistd.h> | |
using std::cout; | |
using std::endl; | |
int main() | |
{ | |
cout << std::thread::hardware_concurrency() << endl; | |
cout << sysconf(_SC_NPROCESSORS_ONLN) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment