출처 : http://xerror.tistory.com/58
아 참고로 위의 블로그에 나온 대로 하니
CPU는 잘 되는데,
메모리는 사용할 수 있는 메모리 밖에 체크가 안되더라 ㅠㅠ
메모리 체크는 아래 링크로 !
private PerformanceCounter cpuCounter;
int cpuVal = 0;
public Form1()
{
InitializeComponent();
InitPerformanceCounter();
GetValue();
}
private void InitPerformanceCounter()
{
cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
}
private void GetValue()
{
cpuVal = (int)cpuCounter.NextValue();
}
모니터링을 위해서라면,
타이머를 이용해보자.