如何在Windows中查找特定进程在该时刻的CPU使用情况
How to find the cpu usage of a particular process at that moment of time in Windows
是否可以在Windows中以编程方式(以任何语言)了解正在运行/空闲进程的CPU使用率?
如果你不关心支持旧的Windows版本(早于Windows XP SP1),你可以使用GetSystemTimes Win32 API函数。
否则,必须使用性能计数器。
在C#
中,您可以执行以下操作:
private PerformanceCounter cpuCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
cpuCounter.NextValue(); // it will give you cpu usage
详情请参考此处。
相关文章:
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- 在模拟器中使用并集来模拟CPU寄存器有多合适
- 编写一个函数以使用 n 百分比的 CPU 使用率
- 如何禁用 CPU 的无序执行
- CPU 瓶颈;处理具有许多非静态对象的 3D 场景渲染的简单方法
- 分别测量每个线程上花费的 CPU 时间(C++)
- 什么时候最好在子进程中使用 CPU 或 I/O 密集型代码 [ C++ ]
- 在程序运行时监视 VxWorks 中的任务 CPU 利用率
- 模板到函数的时刻地址是否可以作为指向某个函数的函数指针传递?
- 对于等待以 std::future wait() 返回的函数的 CPU 使用率或检查标志在循环中休眠一段时间哪个更好?
- 您选择的 CPU 不支持 x86-64 指令集
- 如何在单击按钮FLTK的确切时刻获得小部件的值
- 如何降低应用程序的 CPU 使用率?
- 对于 CPU 无法原子操作的类型,std::atomic 有什么意义?
- 如何区分CPU和内存瓶颈?
- 如何以编程方式获取任务管理器进程CPU使用率(不是PerfMon API)
- CPU 如何提供memory_order_acquire保证?
- 一段时间后 CPU 使用率高
- C/C++memcpu基准测试:测量CPU和墙时间
- 如何在Windows中查找特定进程在该时刻的CPU使用情况