开发者

How to get cpu usage % in C# for each running process

I use System.Diagnostics.Process.GetProcesses() to get process list. I found TotalProcessorTime property for each process - it is TimeSpan.

But how to get relative values of CPU usage, i. e. i need 开发者_开发技巧% of total CPU usage for each running process.


use WQL (queries WMI like SQL) see attached link for few samples:WQL

Win32_PerfFormattedData_PerfProc_Process is your class for getting CPU data.


I found a workaround decision see this question

The plan is as follows: take counters data in stndard way, then process log files. Realtime monitoring is not critical.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜