【问题标题】:.NET CLR Networking 4.0.0.0 -> create Performance Counter.NET CLR Networking 4.0.0.0 -> 创建性能计数器
【发布时间】: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 没有创建吗?

谢谢。

【问题讨论】:

    标签: c#-4.0 performancecounter


    【解决方案1】:

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

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

    【讨论】:

    • 好的,谢谢您的解释!你知道吗,如果我想用其他解决方案检测浏览器网络监控?我使用 Netsh 跟踪搜索实际解决方案,但如果您有更好的解决方案,我很感兴趣!! :-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多