46 lines
860 B
C
46 lines
860 B
C
|
|
//
|
||
|
|
// Created by xtkuang on 2025/5/13.
|
||
|
|
//
|
||
|
|
|
||
|
|
#ifndef CMVR_ES_MONITOR_H
|
||
|
|
#define CMVR_ES_MONITOR_H
|
||
|
|
|
||
|
|
#include <fstream>
|
||
|
|
#include <sstream>
|
||
|
|
#include <string>
|
||
|
|
#include <cmath>
|
||
|
|
#include <mutex>
|
||
|
|
#include <unistd.h>
|
||
|
|
#include <sys/statvfs.h>
|
||
|
|
#include <glog/logging.h>
|
||
|
|
#include "../utils/base/timer.h"
|
||
|
|
#include "rapidxml/xml_parser.h"
|
||
|
|
|
||
|
|
namespace cmvr::device {
|
||
|
|
struct SystemStatus {
|
||
|
|
float cpu_usage;
|
||
|
|
float used_memory;
|
||
|
|
float total_memory;
|
||
|
|
float used_disk;
|
||
|
|
float total_disk;
|
||
|
|
float cpu_temperature;
|
||
|
|
};
|
||
|
|
|
||
|
|
class SystemMonitor {
|
||
|
|
public:
|
||
|
|
SystemMonitor()=default;
|
||
|
|
~SystemMonitor()=default;
|
||
|
|
void getStatus(SystemStatus &status);
|
||
|
|
private:
|
||
|
|
SystemStatus status_{};
|
||
|
|
void get_cpu_();
|
||
|
|
void get_memory_();
|
||
|
|
void get_disk_();
|
||
|
|
};
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#endif //CMVR_ES_MONITOR_H
|