简体   繁体   English

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

[英]Monitor a specific port with Performance Counter

Is there any way I can use Performance Counter to monitor all the traffic, but in a specific port? 有什么方法可以使用性能计数器来监视所有流量,但是可以监视特定端口?

I am doing: 我在做:

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();  
    }

But it seems to log everything 但似乎记录了一切

With performance counters, somebody has to explicitly provide each counter value to the registry. 使用性能计数器,必须有人将每个计数器值显式提供给注册表。 If nobody is providing the specific value you are looking for as input, then there is no way to get it out. 如果没有人提供您正在寻找的特定值作为输入,则没有办法将其输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM