List all processes and their current memory & CPU consumption?

前端 未结 1 498
北海茫月
北海茫月 2020-12-08 05:30

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

Sample code is highly appreciated.

相关标签:
1条回答
  • 2020-12-08 05:58

    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.

    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

    0 讨论(0)
提交回复
热议问题