5
I need to get CPU usage of a process that is a variable.
Ex.:
var process = wait.exe
And check the Wait.exe, if it has reached 100 CPU usage.
How can I do this?
5
I need to get CPU usage of a process that is a variable.
Ex.:
var process = wait.exe
And check the Wait.exe, if it has reached 100 CPU usage.
How can I do this?
1
You can use the class PerformanceCounter
that is in namespace System.Diagnostics
public int GetCpuUsage()
{
System.Diagnostics.PerformanceCounter cpuCounter;
cpuCounter = new System.Diagnostics.PerformanceCounter("Process", "% Processor Time", System.Diagnostics.Process.GetProcessesByName("wait").First().ProcessName);
return (int)cpuCounter.NextValue();
}
Browser other questions tagged c#
You are not signed in. Login or sign up in order to post.
"if it reached 100 CPU usage". What do you mean by that?
– Jéf Bueno
This is what you want? I need to call Accurate CPU Usage of a single process
– Ismael
@jbueno guess he meant 100% processor usage in task manager.
– Oralista de Sistemas
, this gets the CPU usage of the process using e.g.: https://uploaddeimagens.com.br/images/000/888/941/full/Capturar.JPG
– Guilherme