【发布时间】:2012-10-24 01:52:21
【问题描述】:
我尝试在 c# 中创建一个 performanceCounter 来监控我的浏览器的网络连接;
当我显示查找我的浏览器 instanceName 的列表时,CounterPerformance“.NET CLR Networking 4.0.0.0”不会对此进行监控...
我创建了我的计数器:
bytesSent = new PerformanceCounter();
bytesSent.CategoryName = ".NET CLR Networking 4.0.0.0";
bytesSent.CounterName = "Bytes Sent";
bytesSent.InstanceName = instanceName; // instanceName of my browser.
bytesSent.ReadOnly = true;
我会显示监控的实例列表:
PerformanceCounterCategory category = new PerformanceCounterCategory(".NET CLR Networking 4.0.0.0");
string[] listMonitoredApplication = category.GetInstanceNames();
foreach (string monitoredInstanceName in listMonitoredApplication)
{
Console.WriteLine(" - " + monitoredInstanceName);
}
我每隔 1 秒显示一次 performanceCounter 列表,列表中只有:
- myApplicationInstanceName
- _global_
您知道为什么我的浏览器 PerformanceCounter 没有创建吗?
谢谢。
【问题讨论】: