列出所有进程及其当前存储兼; CPU的消耗?消耗、进程、CPU

2023-09-02 20:45:46 作者:歲月裏妳很倔

我怎样才能在C#中,然后为每个进程当前的内存和CPU的消耗?

how can I get a list of all processes in C# and then for each process current memory and CPU consumption?

样品code是高度AP preciated。

Sample code is highly appreciated.

感谢您!

推荐答案

在 Process类有一个GetProcesses方法,可以让你列举正在运行的进程,并列出了一堆统计像内存使用情况和CPU时间。看看下面的统计特性的文档。

The Process class has a GetProcesses method that will let you enumerate the running processes and list a bunch of stats like memory usage and CPU time. Look at the documentation under properties for the stats.

内存使用是一个复杂的问题。实在是没有单号,描述了使用。请参阅Russinovich的优秀系列此事。第一期是在这里:http://blogs.technet.com/markrussinovich/archive/2008/07/21/3092070.aspx

Memory usage is a complex matter. There is really no single number, that describe the usage. Please see Russinovich's excellent series on the matter. The first installment is here: http://blogs.technet.com/markrussinovich/archive/2008/07/21/3092070.aspx

 
精彩推荐
图片推荐