【发布时间】:2012-04-28 18:33:33
【问题描述】:
我正在尝试使用内存性能计数器:
System.Diagnostics.PerformanceCounter theMemCounter =
new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes",
System.Diagnostics.Process.GetCurrentProcess().ProcessName, true);
var memStart = theMemCounter.NextValue();
但在第二行我收到以下错误:
Counter is single instance, instance name 'WebDev.WebServer40' is not valid for this counter category.
有什么问题?
【问题讨论】:
-
如果您打开 perfmon,您会在 Memory 类别中看到该计数器吗?
-
你说的是CategoryName这个属性吗?如果是,这里是:
CategoryName = "Memory".
标签: c# .net performance performancecounter