c#中的进程统计信息

时间:2012-08-31 21:19:21

标签: c# performancecounter

对于给定的流程,我该如何学习

  • cpu usage(%)
  • 内存使用情况(已分配的内存)
  • 网络使用情况(字节数/秒,字节数/秒)

我有兴趣从c#app收集这些信息。

3 个答案:

答案 0 :(得分:2)

可以使用PerformanceCounter Class跟踪所有信息。

您可以找到更详细的列表here,了解您可以跟踪哪种信息。

答案 1 :(得分:2)

This articlethis example +一些c#编码技巧就是您所需要的。

哦,关于流程网络监控,Microsof has a Network Monitor APIYAPM是超人。

答案 2 :(得分:0)

C#中内置了可以执行此操作的类。一个简单的谷歌搜索“计算cpu使用量C#的内存使用量C#”将它们提升了

http://bhaskarrajukonduru-dotnet.blogspot.ca/2010/06/calculate-memory-and-cpu-usage-by-using.html http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c(注意,您也可以搜索stackoverflow) http://www.codeproject.com/Articles/10258/How-to-get-CPU-usage-of-processes-and-threads