diff --git a/Info.hpp b/Info.hpp new file mode 100644 index 0000000..46bf74c --- /dev/null +++ b/Info.hpp @@ -0,0 +1,37 @@ +#include +#include +#include + +namespace Columbus +{ + + int GetCPUCount(); + + + + int GetCPUCount() + { + #ifdef __linux__ + int counter = 0; + + FILE *cpuinfo = fopen("/proc/cpuinfo", "rb"); + + char* str; + size_t size; + + while(getline(&str, &size, cpuinfo) != -1) + { + if (strstr(str, "processor") != 0) + counter++; + } + + fclose(cpuinfo); + return counter; + #endif + } + +} + + + +