如何获得系统的内存使用情况和cpu负载情况?

wlpwind 2004-03-26 09:59:12
如何获得系统的内存使用情况和cpu负载情况?
用VC实现。
...全文
128 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
greensofter 2004-03-26
  • 打赏
  • 举报
回复
http://www.codeguru.com/Cpp/W-P/system/performancestatistics/article.php/c2845/
bluebohe 2004-03-26
  • 打赏
  • 举报
回复

http://expert.csdn.net/Expert/topic/2309/2309423.xml?temp=.0920679
http://expert.csdn.net/Expert/topic/2319/2319630.xml?temp=.694729
http://expert.csdn.net/Expert/topic/2309/2309423.xml?temp=.0920679

bluebohe 2004-03-26
  • 打赏
  • 举报
回复
获得cpu时间:
BOOL GetProcessTimes(
HANDLE hProcess, // handle to process
LPFILETIME lpCreationTime, // process creation time
LPFILETIME lpExitTime, // process exit time
LPFILETIME lpKernelTime, // process kernel-mode time
LPFILETIME lpUserTime // process user-mode time
);

关于io信息:
BOOL GetProcessIoCounters(
HANDLE hProcess, // handle to process
PIO_COUNTERS lpIoCounters // I/O accouting information
);


bluebohe 2004-03-26
  • 打赏
  • 举报
回复
关于内存的绝大多数信息可以通过以下函数获得:

BOOL GetProcessMemoryInfo(
HANDLE Process, // handle to process
PPROCESS_MEMORY_COUNTERS ppsmemCounters, // buffer
DWORD cb // size of buffer
);

The GetProcessMemoryInfo function retrieves information about the memory usage of the specified process in the PROCESS_MEMORY_COUNTERS structure.

typedef struct _PROCESS_MEMORY_COUNTERS {
DWORD cb;
DWORD PageFaultCount;
SIZE_T PeakWorkingSetSize;
SIZE_T WorkingSetSize;
SIZE_T QuotaPeakPagedPoolUsage;
SIZE_T QuotaPagedPoolUsage;
SIZE_T QuotaPeakNonPagedPoolUsage;
SIZE_T QuotaNonPagedPoolUsage;
SIZE_T PagefileUsage;
SIZE_T PeakPagefileUsage;
} PROCESS_MEMORY_COUNTERS;
typedef PROCESS_MEMORY_COUNTERS *PPROCESS_MEMORY_COUNTERS;

2,640

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧