Implementar CpuMon al completo
Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
#include "ui.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
@ -8,12 +10,50 @@
|
||||
|
||||
#ifndef CPU_MON_HPP_
|
||||
#define CPU_MON_HPP_
|
||||
|
||||
const int NUM_ESTADOS_CPU = 10;
|
||||
|
||||
enum EstadosCPU {
|
||||
S_USER = 0,
|
||||
S_NICE,
|
||||
S_SYSTEM,
|
||||
S_IDLE,
|
||||
S_IOWAIT,
|
||||
S_IRQ,
|
||||
S_SOFTIRQ,
|
||||
S_STEAL,
|
||||
S_GUEST,
|
||||
S_GUEST_NICE
|
||||
};
|
||||
|
||||
typedef struct DatosCPU {
|
||||
std::string cpu;
|
||||
size_t times[NUM_ESTADOS_CPU];
|
||||
} DatosCPU;
|
||||
|
||||
class CpuMon {
|
||||
private:
|
||||
int8_t num_hilos;
|
||||
uint8_t num_hilos;
|
||||
uint8_t num_sectores;
|
||||
int columnas;
|
||||
WINDOW *ventanaMonitorCPU;
|
||||
static void esperar(int segundos);
|
||||
bool enFuncionamiento;
|
||||
|
||||
public:
|
||||
CpuMon(int8_t num_hilos);
|
||||
CpuMon(uint8_t num_hilos, WINDOW *ventanaMonitorCPU);
|
||||
void iniciarCPU_MON();
|
||||
void pararCPU_MON();
|
||||
|
||||
// int getColumnas();
|
||||
// uint8_t getNum_sectores();
|
||||
size_t getTiempoInactivo(const DatosCPU &e);
|
||||
size_t getTiempoActivo(const DatosCPU &e);
|
||||
void leerEstadoCPU(std::vector<DatosCPU> &entradas);
|
||||
void obtenerUsoCPU(const std::vector<DatosCPU> &entradas1,
|
||||
const std::vector<DatosCPU> &entradas2);
|
||||
void setEnfuncionamiento(bool enFuncionamiento);
|
||||
std::string obtenerBarra(float *porcentaje, uint8_t *cpu);
|
||||
void setNum_sectores(uint8_t num_sectores);
|
||||
};
|
||||
#endif // CPU_MON_HPP_
|
||||
|
@ -27,5 +27,11 @@ void showCenterMensaje(std::vector<std::string> *mensaje,
|
||||
const uint8_t *menu_color);
|
||||
|
||||
void showTopTitle(const std::vector<std::string> *titulo);
|
||||
|
||||
void mostrarVentana(WINDOW *ventana, std::vector<std::string> *texto,
|
||||
int *ancho, uint8_t *sectores);
|
||||
|
||||
void borrarVentana(WINDOW *ventana);
|
||||
|
||||
} // namespace ui
|
||||
#endif // __UI_HPP_
|
||||
|
Reference in New Issue
Block a user