Recently, I needed a routine to calculate CPU usage so that I could detect when a process went idle. As usual a quick search on
Google Groups turned up the answer in
this post. The routine calls
GetProcessTimes then sleeps for a brief period, calls it again and calculates the average over that interval. The only change I made was to take into account the number of CPU's on the system by calling
GetSystemInfo and divide accordingly.
307e6b7e-7af0-42aa-b8fc-d6bbc7b5feb8|0|.0
Tags: Programming
Spam filtering provided by:
335 comments approved,
1474 spam caught since October 28, 2009