#include <iostream> #include <thread> #include <unistd.h> using namespace std; int main () { //threads count int threads = thread::hardware_concurrency(); cout << "Supported threads : " << threads << endl; //processors count int prs = sysconf(_SC_NPROCESSORS_ONLN); cout << "Processors : " << prs << endl; //memory size double memory = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE); int i=0; for(i=0; memory >= 1024; i++) { memory/= 1024; } cout << "Memory size : " << memory << " "; switch(i) { case 1: cout << "KB"; break; case 2: cout << "MB"; break; case 3: cout << "GB"; break; default: cout << "Byte"; break; } cout << endl; return 0; }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more