PERF_100NSEC_TIMER_INV - The inverse of the timer. Used when the object is not in use.
|Data Size||8 Bytes|
When the application calls the PdhCollectQueryData PDH function the first time, the PDH library collects X0 (the total time taken by the processor that is running the thread of the idle process) and Y0 (the time measured in Time base units). The second time the application calls PdhCollectQueryData, the previous sample becomes X0 and Y0, and the current call becomes X1 and Y1.
When the application calls the PdhGetFormattedCounterValue PDH function, the calculation described in the previous paragraph is performed to calculate the % Processor Time. This calculation relies on a previous sample, which is not present if PdhCollectQueryData is called only once (there is no X0 and Y0). Therefore, if any performance counter requires two sample collections, PdhGetFormattedCounterValue can be called only after the second PdhCollectQueryData is called.
Furthermore, when retrieving the % Processor Time, there must be a delay between sample collections, because just running the code will have a slight impact on the calculation of % Processor Time. The application can delay by calling Sleep(few 100 milliseconds) in between PdhCollectQueryData function calls.
Artikelnummer: 262938 – Letzte Überarbeitung: 21.11.2006 – Revision: 1