Note that there are some explanatory texts on larger screens.

plurals
  1. POObtain Total CPU Time of Idle Process in Windows similar to Task Manager
    primarykey
    data
    text
    <p>I am working on a large application and want to get an idea of how loaded the CPU was between two points in time. I am not just interested in my own process, but all processes.</p> <p>My idea is to get the Total CPU Time of the Idle Process between two time periods. Then compare that value to the real time difference. It is then possible to calculate the average % CPU Time spent on the Idle process, and hence the average % CPU spent on actual processes.</p> <p>For instance:</p> <ul> <li>Real Time Samples: 2012/07/30 13:56:1 and 2012/07/30 13:56:21</li> <li>Idle Process Total CPU Time Samples: 56:23:10 and 56:23:15</li> <li>Difference in Real Time: 20s </li> <li>Difference in Idle Process Total CPU Time: 5s </li> <li>Average % CPU Time in Idle Process: 25% </li> <li>Average % CPU Time in Actual Processes: 75%</li> </ul> <p>In order to have as little performance impact as possible, I only want to take two samples. One at the beginning and one at the end.</p> <p>I also do not want to look at other processes in order to calculate the total CPU load, only the Idle Process. (For instance I don't want to calculate the sum of Total CPU Time of other processes)</p> <p>I have tried to use the Kernel32.dll <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms684320%28v=vs.85%29.aspx" rel="nofollow">OpenProcess</a>. But apperantly you cannot access the Idle Process. It throws an ERROR_ACCESS_DENIED exception. </p> <p>This must be possible as Task Manager displays the Total CPU Time of the Idle Process.</p> <p><strong>NOTE: I am NOT interested in the Instantaneous % CPU Time of the Processes. Only the Total CPU Time in order to calculate the average later.</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload