1 InstanceIndex = 0;
2
3 performanceCounterCategory = new PerformanceCounterCategory("Network Interface");
4
5 performanceCounterBytesReceived = new PerformanceCounter("Network Interface", "Bytes Received/sec");
6 performanceCounterBytesReceived.InstanceName = performanceCounterCategory.GetInstanceNames()[instanceIndex];
7 performanceCounterBytesReceived.MachineName = performanceCounterCategory.MachineName;
8 performanceCounterBytesReceived.ReadOnly = true;
9
10 performanceCounterCurrentBandwidth = new PerformanceCounter("Network Interface", "Current Bandwidth");
11 performanceCounterCurrentBandwidth.InstanceName = performanceCounterCategory.GetInstanceNames()[instanceIndex];
12 performanceCounterCurrentBandwidth.MachineName = performanceCounterCategory.MachineName;
13 performanceCounterCurrentBandwidth.ReadOnly = true;