Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 .NET CLR网络4.0.0.0->;创建性能计数器_C# 4.0_Performancecounter - Fatal编程技术网

C# 4.0 .NET CLR网络4.0.0.0->;创建性能计数器

C# 4.0 .NET CLR网络4.0.0.0->;创建性能计数器,c#-4.0,performancecounter,C# 4.0,Performancecounter,我尝试用c语言创建一个performanceCounter,用于监视浏览器的网络连接 当我显示“查找我的浏览器instanceName”列表时,它不受“.NET CLR Networking 4.0.0.0”对应性能的监视 我创建我的计数器: bytesSent = new PerformanceCounter(); bytesSent.CategoryName = ".NET CLR Networking 4.0.0.0"; bytesSent.CounterName = "Bytes Sen

我尝试用c语言创建一个performanceCounter,用于监视浏览器的网络连接

当我显示“查找我的浏览器instanceName”列表时,它不受“.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);
}
我每1s显示一次performanceCounter列表,列表中只有:

- myApplicationInstanceName
- _global_
你知道为什么我的浏览器性能计数器没有被创建吗


谢谢。

这是因为浏览器不使用.NET framework类来传输数据。浏览器使用本机代码


您需要使用不同的性能计数器,如“网络接口”类别中的计数器。另外,tcp/ip驱动程序堆栈不保存单个进程的统计信息,只保存特定网络接口的统计信息。没有解决方法。

好的,谢谢您的解释!你知道吗,如果我想用其他解决方案检测浏览器网络监控?我用Netsh trace搜索解决方案,但若你们有更好的解决方案,我很感兴趣!!:-)