November 24th, 2012, 06:48 AM
Get a specific process CPU usage using VB.Net
I want to get the CPU usage for a specific process. I have used as below:
The total CPU Usage is 25% (Task Manager).
instancename = "myexe"
_cnt = New PerformanceCounter("Processor", "% Processor Time", instancename, True)
label1.text = _cnt.NextValue
The process shows "25" in task manager but the value returned using the above code returns "99".
Please somebody can explain me why there is a difference in the value present in the task manager and the one returned through code? And how i can get the value as the same one present in Task Manager?