Given a process id, how can I get CPU utilization from this process using C #?
I tried using PerformanceCounter as described in C # to calculate CPU usage for a specific application
I also tried to manually take two values โโof the total processor time for the process during the timeframe and divide the delta-cpu time with the delta-total time.
Both of these methods work fine, but if I put my application next to the window manager, my application will always be about twice as large as the task manager does. I tried updating various timestamps from 10 ms to 10 sec and getting the same result all the time.
Hmm, I realized when I wrote this that it could be some kind of dual-core problem ...
bly
source
share