Given a process ID, how can i get the cpu load from this process with C#?
I have tried using PerformanceCounter as described in http://stackoverflow.com/questions/1277556/c-calculate-cpu-usage-for-a-specific-application
I have also tried to manually take two values of the total cpu time for the process within a timeframe and divide the delta-cpu-time with the delta-total-time.
Both these methods seems to work fine at first but if i put my application next to windows task manager my application always shows about twice as much as the task manager does. I have tried to update with various timesteps from 10ms to 10sec and get same result all the time.
Hmm, realized when i wrote this that it might be some kind of dual core issue...