Visual C ++:如何获取CPU时间? [英] Visual C++: How to get the CPU time?

查看:121
本文介绍了Visual C ++:如何获取CPU时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Visual C ++以编程方式找到System Idle Process(在任务管理器中)显示的CPU时间?

How can I programatically find the CPU time which is displayed in System Idle Process (in Task Manager) using Visual C++?

推荐答案

您想要的是这样的东西...

What you want is something like this...

NTSTATUS hStatus;
SYSTEM_PERFORMANCE_INFORMATION             stSysPerfInfo;

hStatus = NtQuerySystemInformation(SystemPerformanceInformation, &stSysPerfInfo, sizeof(stSysPerfInfo), NULL);
if (hStatus != NO_ERROR)
{
  // Do work....
}

或者看看这个"TaskManager"

Or take a look at this "TaskManager"

http: //reactos.freedoors.org/Reactos%200.3.8/ReactOS-0.3.8-REL-src/base/applications/taskmgr/

这篇关于Visual C ++:如何获取CPU时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆