Благодаря лунному свету я нашел это http://www.keyvan.ms/how-to-calculate-network-utilization-in-net
public double getNetworkUtilization(string networkCard){
const int numberOfIterations = 10;
PerformanceCounter bandwidthCounter = new PerformanceCounter("Network Interface", "Current Bandwidth", networkCard);
float bandwidth = bandwidthCounter.NextValue();//valor fixo 10Mb/100Mn/
PerformanceCounter dataSentCounter = new PerformanceCounter("Network Interface", "Bytes Sent/sec", networkCard);
PerformanceCounter dataReceivedCounter = new PerformanceCounter("Network Interface", "Bytes Received/sec", networkCard);
float sendSum = 0;
float receiveSum = 0;
for (int index = 0; index < numberOfIterations; index++)
{
sendSum += dataSentCounter.NextValue();
receiveSum += dataReceivedCounter.NextValue();
}
float dataSent = sendSum;
float dataReceived = receiveSum;
double utilization = (8 * (dataSent + dataReceived)) / (bandwidth * numberOfIterations) * 100;
return utilization;
}
, чтобы найти доступные сетевые карты, этот код помог мне:
public void printNetworkCards()
{
PerformanceCounterCategory category = new PerformanceCounterCategory("Network Interface");
String[] instancename = category.GetInstanceNames();
foreach (string name in instancename)
{
Console.WriteLine(name);
}
}