Files
SimpleRemoter/server/2015Remote/CpuUseage.h
yuanyuanxiang 27fcb6284e 基于gh0st的远程控制器
实现了终端管理、进程管理、窗口管理、桌面管理、文件管理、语音管理、视频管理、服务管理、注册表管理等功能。
2019-01-05 20:21:43 +08:00

35 lines
655 B
C++

#pragma once
#include <pdh.h>
#include <pdhmsg.h>
#pragma comment(lib,"PDH.lib")
#define MAX_RAW_VALUES 20
//process 项目下的% Processor Time计数器是关于进程CPU使率的
const char szCounterName[] = "\\Processor(_Total)\\% Processor Time";
typedef struct _tag_PDHCounterStruct {
HCOUNTER hCounter;
int nNextIndex;
int nOldestIndex;
int nRawCount;
PDH_RAW_COUNTER a_RawValue[MAX_RAW_VALUES];
} PDHCOUNTERSTRUCT, *PPDHCOUNTERSTRUCT;
class CCpuUsage
{
public:
CCpuUsage();
virtual ~CCpuUsage();
BOOL Init();
int GetUsage();
protected:
PPDHCOUNTERSTRUCT m_pCounterStruct;
HQUERY m_hQuery;
};