diff --git a/bin/resource-monitor b/bin/resource-monitor deleted file mode 100755 index 5d333c1..0000000 Binary files a/bin/resource-monitor and /dev/null differ diff --git a/include/common.h b/include/common.h new file mode 100644 index 0000000..e358acd --- /dev/null +++ b/include/common.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include + +std::vector exec(std::string command) { + char buffer[128]; + std::vector result; + FILE* pipe = popen(command.c_str(), "r"); + try { + while (fgets(buffer, sizeof buffer, pipe) != NULL) { + result.push_back(buffer); + } + } catch (...) { + pclose(pipe); + throw; + } + pclose(pipe); + return result; +} + diff --git a/include/fans.h b/include/fans.h deleted file mode 100644 index e69de29..0000000 diff --git a/include/sys.h b/include/sys.h index e69de29..07ec564 100644 --- a/include/sys.h +++ b/include/sys.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include +#include +#include + +struct Sys { + unsigned long long SYSTEM_UPTIME; + unsigned short CPU_CORES; + +}; diff --git a/include/temp.h b/include/temp.h new file mode 100644 index 0000000..3f59c93 --- /dev/null +++ b/include/temp.h @@ -0,0 +1,2 @@ +#pragma once + diff --git a/platform/linux/common.cpp b/platform/linux/common.cpp new file mode 100644 index 0000000..280d919 --- /dev/null +++ b/platform/linux/common.cpp @@ -0,0 +1,22 @@ +// #include + +// #include +// #include +// #include +// #include + +// std::vector exec(std::string command) { +// char buffer[128]; +// std::vector result; +// FILE* pipe = popen(command.c_str(), "r"); +// try { +// while (fgets(buffer, sizeof buffer, pipe) != NULL) { +// result.push_back(buffer); +// } +// } catch (...) { +// pclose(pipe); +// throw; +// } +// pclose(pipe); +// return result; +// } diff --git a/src/main.cpp b/src/main.cpp index 2323a2c..8eae3d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include @@ -14,6 +14,11 @@ int main(int argc, char** argv) { cpu->START_CPU_POLLING(); mem->START_MEMORY_POLLING(); + std::vector lscpu = exec("lscpu"); + for (unsigned int i = 0; i < lscpu.size(); i++) { + std::cout << lscpu[i] << std::endl; + } + while(1) { sleep(1); std::cout << std::endl;