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

Регистрация
28.10.2017
Сообщения
1 123
Реакции
256
Сайт
tehadm.ru
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";
}
 
Верх