#include #include #include #include struct EntityEntry { CSimpleStringA Name; CSimpleStringA ModuleName; int Type; int State; int Id; int Pid; int DevelopID; int DebugLevel; CSmallDateTime lastStartTime; static const char* GetTypeName(int type) { static const char* _names[] = { "auto", "manual" }; return _names[type % ARRAYSIZE(_names)]; } static const char* GetStateName(int state) { static const char* _names[] = { "NoStart", "Starting", "Idle", "Busy", "Pause", "UnLoading", "Lost", "Close", "Killed", }; return _names[state % ARRAYSIZE(_names)]; } static const char* GetErrorName(ErrorCodeEnum Error) { return "Unknown Error"; } }; #define OP_STOP_ENTITY 0 #define OP_START_ENTITY 1 #define OP_PAUSE_ENTITY 2 #define OP_TERMINATE_ENTITY 3 #define OP_CONTINUE_ENTITY 4 #define OP_FIRE_ENTITY_STATE 5 struct callback_entry : public IReleasable { virtual ~callback_entry() {} CSimpleStringA EntityName; union { void* pRawData; int state; }; int op; ErrorCodeEnum ErrorResult; }; struct TerminalBaseInfo { CSimpleStringA strTerminalNo; CSimpleStringA strMachineType; CSimpleStringA strSoftwareVersion; TerminalBaseInfo() :strTerminalNo(true), strMachineType(true), strSoftwareVersion(true) {} TerminalBaseInfo(TerminalBaseInfo& rhs) :strTerminalNo(rhs.strTerminalNo), strMachineType(rhs.strMachineType), strSoftwareVersion(rhs.strSoftwareVersion) {} TerminalBaseInfo(const TerminalBaseInfo& rhs) :strTerminalNo(rhs.strTerminalNo), strMachineType(rhs.strMachineType), strSoftwareVersion(rhs.strSoftwareVersion) { } }; // ½« process ¸ÄÃûΪ processStatus struct processStatus { std::string processName; int ID; double PercentProcessorTime; unsigned long UsedMemory; double PercentMemory; int HandleCount; char UserName[MAX_PATH]; //ULONGLONG UpTime; //DWORD BasePriority; //DWORD ParentPID; //ULONGLONG DiskOperationsPrev; //ULONGLONG DiskOperations; //DWORD DiskUsage; //DWORD TreeDepth; // Constructor to initialize the fields processStatus() { ID = 0; PercentProcessorTime = 0.0; UsedMemory = 0; PercentMemory = 0.0; HandleCount = 0; ZeroMemory(UserName, sizeof(UserName)); //Handle = nullptr; //UpTime = 0; //BasePriority = 0; //ParentPID = 0; //DiskOperationsPrev = 0; //DiskOperations = 0; //DiskUsage = 0; //TreeDepth = 0; } }; struct system_monitor_status { std::vector processList; double total_cpu; long total_tasks; ULONGLONG total_uptime; ULONGLONG TotalMemory; ULONGLONG UsedMemory; double UsedMemoryPerc; ULONGLONG TotalPageMemory; ULONGLONG UsedPageMemory; double UsedPageMemoryPerc; // Constructor to initialize the fields system_monitor_status() : total_cpu(0.0), total_tasks(0), total_uptime(0), TotalMemory(0), UsedMemory(0), UsedMemoryPerc(0.0), TotalPageMemory(0), UsedPageMemory(0), UsedPageMemoryPerc(0.0) { processList.clear(); } }; #define TO_MB(X) ((X)/1048576) std::pair PollProcessList(long UpdateTime, system_monitor_status& curStatus); std::string GenerateTimeStr(); std::string LogTypeEnumToString(LogTypeEnum logType); LogTypeEnum StringToLogTypeEnum(const std::string& logTypeStr); void startProcess(std::string cmdline, bool isWait);