我正在尝试读取“.NET CLR 异常”类别的性能计数器。下面是相同的代码。我看到的是在我构建的 Windows Perfmon 计数器和控制台应用程序中显示的不同数据。
PerformanceCounterCategory netClrExceptionCat = new PerformanceCounterCategory(".NET CLR Exceptions");
foreach (PerformanceCounter counter in netClrExceptionCat.GetCounters("_Global_"))
{
Console.WriteLine(string.Format(" Counter: {0} : Value : {1}", counter.CounterName, counter.RawValue));
}
如果有人能指出正确的方向,我将不胜感激,以防我在这里做错了什么。