me_elsagh
پنج شنبه 26 آذر 1388, 13:02 عصر
به دست آوردن میزان استفاده ازcpuیکprocessبه چه صورت است؟
HollyGhost
پنج شنبه 26 آذر 1388, 13:33 عصر
اولین نتیجه از گوگل:
http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-c
تعریفات در کلاس
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";
}
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.