60 lines
1.2 KiB
C
60 lines
1.2 KiB
C
|
#ifndef SYSTEMINFOMONITOR_H
|
||
|
#define SYSTEMINFOMONITOR_H
|
||
|
|
||
|
#include "XNMonitorServer_global.h"
|
||
|
#include <map>
|
||
|
#include <mutex>
|
||
|
#include "TypeDefine.h"
|
||
|
#include "TopicManager.h"
|
||
|
#include "../XNCore/XNIDL/XNSimStatusPubSubTypes.hpp"
|
||
|
|
||
|
class XNMONITORSERVER_EXPORT SystemInfoMonitor
|
||
|
{
|
||
|
public:
|
||
|
explicit SystemInfoMonitor() {}
|
||
|
virtual ~SystemInfoMonitor();
|
||
|
|
||
|
public:
|
||
|
std::string Initialize();
|
||
|
|
||
|
std::string GetSystemInfo();
|
||
|
std::string GetAllThreadInfo();
|
||
|
|
||
|
private:
|
||
|
/**
|
||
|
* @brief 引擎状态监听器
|
||
|
* @param status 引擎状态
|
||
|
*/
|
||
|
void EngineStatusListener(const XNSim::XNSimStatus::XNEngineStatus &status);
|
||
|
/**
|
||
|
* @brief 线程状态监听器
|
||
|
* @param status 线程状态
|
||
|
*/
|
||
|
void ThreadStatusListener(const XNSim::XNSimStatus::XNThreadStatus &status);
|
||
|
|
||
|
private:
|
||
|
/**
|
||
|
* @brief 互斥锁
|
||
|
*/
|
||
|
std::mutex m_EngineStatusMutex;
|
||
|
std::mutex m_ThreadStatusMutex;
|
||
|
/**
|
||
|
* @brief 引擎状态
|
||
|
*/
|
||
|
XNSim::XNSimStatus::XNEngineStatus m_EngineStatus;
|
||
|
/**
|
||
|
* @brief 引擎状态更新
|
||
|
*/
|
||
|
bool m_EngineStatusUpdate = false;
|
||
|
/**
|
||
|
* @brief 线程状态
|
||
|
*/
|
||
|
std::map<uint32_t, XNSim::XNSimStatus::XNThreadStatus> m_ThreadStatus;
|
||
|
/**
|
||
|
* @brief 线程周期计数
|
||
|
*/
|
||
|
std::map<uint32_t, uint64_t> m_ThreadCycleCount;
|
||
|
};
|
||
|
|
||
|
#endif // SYSTEMINFOMONITOR_H
|