简体   繁体   English

有没有办法查看进程使用的每个核心CPU使用量?

[英]Is there a way to see how much CPU usage per core a process is using?

I know in perfmon you can see how much each core is utilized, and how much total CPU a particular process is using. 我知道在perfmon中你可以看到每个核心的使用量,以及特定进程使用的CPU总量。 However I can't seem to find a way to see how much CPU a process is using broken down by cores. 但是我似乎无法找到一种方法来查看进程使用内核分解的CPU数量。

Is there a built-in way to see this information? 是否有内置的方式来查看此信息? Is there a programmatic way to see this? 是否有程序化的方式来看到这个? (C# preferred) Am I demonstrating a misunderstanding of how Windows (Vista) handles core usage and context switching by asking this question? (C#首选)我是否通过提出这个问题来展示对Windows(Vista)如何处理核心使用和上下文切换的误解?

Edit: More clarification of what I want to find out. 编辑:更清楚我要找到的内容。 Is my process only using 30-40% total CPU (on a quad core) because it's not sufficiently multi-threaded to utilize more or is it because it's too I/O bound and disk access is the bottleneck? 我的进程只使用30-40%的总CPU(在四核上),因为它没有足够的多线程来利用更多,或者是因为它太I / O限制和磁盘访问是瓶颈?

So is there no way to do this at all? 所以根本没办法做到这一点吗? (other than make sure there's no other CPU activity going on on the computer) (除了确保计算机上没有其他CPU活动)

Process Explorer at least can show you the threads of a given process and how much CPU those are using. Process Explorer至少可以向您显示给定进程的线程以及使用的CPU数量。 Maybe you can get the core/cpu on which the threads are running somehow and then just add up. 也许你可以以某种方式获得线程运行的核心/ cpu,然后加起来。 I have not much WinAPI experience, though. 不过,我没有太多的WinAPI经验。 So maybe processor affinity can only be queried on processes. 因此,可能只能在进程上查询处理器关联。

您无法直接获取给定进程的每个处理器周期时间,但您可以使用QueryIdleProcessorCycleTime (因为它返回所有逻辑处理器(即内核)的空闲时间)和QueryProcessCycleTime来估计它,并假设它是唯一的非空转过程运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM