PerformanceCounter
을 사용할 수 있습니다. 예제 코드 :
//Define
string pn = "MyProcessName.exe";
var readOpSec = new PerformanceCounter("Process","IO Read Operations/sec", pn);
var writeOpSec = new PerformanceCounter("Process","IO Write Operations/sec", pn);
var dataOpSec = new PerformanceCounter("Process","IO Data Operations/sec", pn);
var readBytesSec = new PerformanceCounter("Process","IO Read Bytes/sec", pn);
var writeByteSec = new PerformanceCounter("Process","IO Write Bytes/sec", pn);
var dataBytesSec = new PerformanceCounter("Process","IO Data Bytes/sec", pn);
var counters = new List<PerformanceCounter>
{
readOpSec,
writeOpSec,
dataOpSec,
readBytesSec,
writeByteSec,
dataBytesSec
};
// get current value
foreach (PerformanceCounter counter in counters)
{
float rawValue = counter.NextValue();
// display the value
}
그리고 이것은 네트워크 카드의 성능 카운터를 얻는 것입니다. 그것은 특정
string cn = "get connection string from WMI";
var networkBytesSent = new PerformanceCounter("Network Interface", "Bytes Sent/sec", cn);
var networkBytesReceived = new PerformanceCounter("Network Interface", "Bytes Received/sec", cn);
var networkBytesTotal = new PerformanceCounter("Network Interface", "Bytes Total/sec", cn);
Counters.Add(networkBytesSent);
Counters.Add(networkBytesReceived);
Counters.Add(networkBytesTotal);
당신이 성능 카운터에 답을 찾지 못했습니다 :
나는 내 프로세스의 네트워크 IO를 다시보고 최근이 같은 것을 썼다? http://www.codeproject.com/Articles/8590/An-Introduction-To-Performance-Counters – Yogee성능 카운터 방식으로 작업하려고했으나 성공하지 못했습니다. 추가 한 링크도 읽으십시오. –
http://stackoverflow.com/questions/438240/monitor-a-processs-network-usage –