diff --git a/bin/resource-monitor b/bin/resource-monitor index de3993e..e4ab974 100755 Binary files a/bin/resource-monitor and b/bin/resource-monitor differ diff --git a/libsys/cpu.h b/libsys/cpu.h index 14f07b1..6713ff6 100644 --- a/libsys/cpu.h +++ b/libsys/cpu.h @@ -42,11 +42,11 @@ public: double CPU_PERCENT(int core); std::vector CPU_CORE_PERCENT(); + bool m_isPolling; virtual ~CPU(); private: std::thread* m_pollThread; - bool m_isPolling; }; static CPU* CPU_Instance; diff --git a/libsys/gpu.cpp b/libsys/gpu.cpp new file mode 100644 index 0000000..15e8bca --- /dev/null +++ b/libsys/gpu.cpp @@ -0,0 +1,9 @@ +#include "gpu.h" + +GPU::GPU() { + +} + +GPU::~GPU() { + +} diff --git a/libsys/gpu.h b/libsys/gpu.h index e69de29..46b3108 100644 --- a/libsys/gpu.h +++ b/libsys/gpu.h @@ -0,0 +1,10 @@ +#pragma once + +class GPU { +public: + GPU(); + + virtual ~GPU(); +}; + +static GPU* GPU_Instance; diff --git a/libsys/libsys.cpp b/libsys/libsys.cpp new file mode 100644 index 0000000..a35549e --- /dev/null +++ b/libsys/libsys.cpp @@ -0,0 +1,13 @@ +#include "libsys.h" + +void initialize_libsys() { + __cpu = new CPU(); + __mem = new Memory(); + __gpu = new GPU(); + __sys = new System(); + + CPU_Instance = __cpu; + Memory_Instance = __mem; + GPU_Instance = __gpu; + System_Instance = __sys; +} diff --git a/libsys/libsys.h b/libsys/libsys.h index 633b954..1a1d1c0 100644 --- a/libsys/libsys.h +++ b/libsys/libsys.h @@ -3,3 +3,10 @@ #include "common.h" #include "sys.h" #include "temp.h" + +void initialize_libsys(); + +static CPU* __cpu; +static Memory* __mem; +static GPU* __gpu; +static System* __sys; diff --git a/libsys/memstat.h b/libsys/memstat.h index b8344cc..c78d22a 100644 --- a/libsys/memstat.h +++ b/libsys/memstat.h @@ -27,10 +27,11 @@ public: static void MEMORY_POLL(Memory* mem); void END_MEMORY_POLLING(); + bool m_isPolling; + virtual ~Memory(); private: std::thread* m_pollThread; - bool m_isPolling; }; static Memory* Memory_Instance; diff --git a/libsys/sys.cpp b/libsys/sys.cpp index 5a31321..732f39d 100644 --- a/libsys/sys.cpp +++ b/libsys/sys.cpp @@ -2,16 +2,6 @@ System::System() { this->m_Sys = new Sys(); - - if (CPU_Instance = NULL) { - CPU_Instance = new CPU(); - } - - if (Memory_Instance == NULL) { - Memory_Instance = new Memory(); - } - - } Sys System::getSystemSpec() { diff --git a/src/main.cpp b/src/main.cpp index 0b682e4..bbb2126 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,15 +4,12 @@ #include int main(int argc, char** argv) { - CPU_Instance = new CPU(); - Memory_Instance = new Memory(); - System_Instance = new System(); + initialize_libsys(); + sleep(1); CPU_Instance->START_CPU_POLLING(); Memory_Instance->START_MEMORY_POLLING(); - sleep(1); - std::cout << std::endl; Sys sys = System_Instance->getSystemSpec();