How to get the cpu usage per thread on windows (win32)(如何在 windows (win32) 上获取每个线程的 CPU 使用率)
问题描述
寻找 Win32 API 函数、C++ 或 Delphi 示例代码,这些代码告诉我线程(而不是进程的总数)的 CPU 使用率(百分比和/或总 CPU 时间).我有线程 ID.
Looking for Win32 API functions, C++ or Delphi sample code that tells me the CPU usage (percent and/or total CPU time) of a thread (not the total for a process). I have the thread ID.
我知道 Sysinternals Process Explorer 可以显示此信息,但我的程序中需要此信息.
I know that Sysinternals Process Explorer can display this information, but I need this information inside my program.
推荐答案
在 RRUZ 上面的回答的帮助下,我终于为 Borland Delphi 想出了这个代码:
With the help of RRUZ's answer above I finally came up with this code for Borland Delphi:
这篇关于如何在 windows (win32) 上获取每个线程的 CPU 使用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!