如何在代码中访问C#性能计数器?

Lan*_*nce 6 c# performance counter performancecounter

我想在我的程序中使用性能计数器输出.如何在不使用perfmon.exe的情况下访问代码中的性能计数器.我想创建自己的性能计数器应用程序.

Ale*_* K. 10

这是通过PerformanceCounter类公开的.


Fox*_*ire 5

您可以通过System.Diagnostics.PerformanceCounter类(此处的文档和示例)与performancecounters完全交互.