使用性能计数器监视特定端口

时间:2013-03-12 18:24:28

标签: c# performancecounter

有什么方法可以使用性能计数器监控所有流量,但是在特定端口?

我在做:

GetCounterValue(_netRecvCounters[index], "Network Interface", "Bytes Received/sec", _instanceNames[index]):

double GetCounterValue(PerformanceCounter pc, string categoryName, string counterName, string instanceName)
    {
        pc.CategoryName = categoryName;
        pc.CounterName = counterName;
        pc.InstanceName = instanceName;
        return pc.NextValue();  
    }

但它似乎记录了所有内容

1 个答案:

答案 0 :(得分:0)

对于性能计数器,有人必须明确地向注册表提供每个计数器值。如果没有人提供您正在寻找的特定值作为输入,则无法将其取出。