2010-03-16 2 views

답변

6

이 링크 코드이 이러한 라인을 시도하십시오

감사 초당
1. 요청
2. CPU 사용량 (각 핸들러 또는 요약) :
나는 다음 통계를 필요 반드시 당신을 도울 것입니다.

http://www.codeproject.com/KB/dotnet/perfcounter.aspx http://www.aspheute.com/english/20000809.asp http://www.csharphelp.com/2006/05/performance-monitoring/

당신은 System.Diagnostics에서 PerformanceCounter 클래스를 사용할 수 있습니다 :

PerformanceCounter cpuCounter; 
PerformanceCounter ramCounter; 

cpuCounter = new PerformanceCounter(); 

cpuCounter.CategoryName = "Processor"; 
cpuCounter.CounterName = "% Processor Time"; 
cpuCounter.InstanceName = "_Total"; 

ramCounter = new PerformanceCounter("Memory", "Available MBytes"); 


public string getCurrentCpuUsage(){ 
      cpuCounter.NextValue()+"%"; 
} 

public string getAvailableRAM(){ 
      ramCounter.NextValue()+"MB"; 
} 

이 모든 것이 당신의 문제를 해결합니다.