Узнать нагрузку RAM

tehadm

Администратор
Сообщения
1 180
Реакции
303
C#:
using System.Diagnostics;

C#:
protected PerformanceCounter cpuCounter;
protected 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";
}
 
Назад
Верх Низ