我尝试在 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 没有创建吗?
谢谢你。