Displaying Data

The raw value of many counters is not what the user would expect to see. To get the information in the form described by most counter names, you need to compute the displayable value based on this raw data. PDH does this for you. For example, the Page Faults/Sec counter simply counts page faults, so if you view the raw data, you see a running total of page faults. To get the rate implied by the counter name, page faults per second, you need to call the PdhGetFormattedCounterValueGFVWXD function. In this case, the function divides the difference between two samples by the time between the samples.

The PdhGetFormattedCounterValue function performs its computations on the most recent sample. If you need to recalculate and redisplay a sample, you must store the raw data and then call the PdhCalculateCounterFromRawValueJFZL1U function to perform the calculation on the stored data.