Collecting Data

After you have created a query and added counters to it, call the PdhCollectQueryDataPIPRSU function to retrieve the current raw data for all counters in the query. Many counters, such as rate counters, require the following two data samples before a valid data value can be determined.

    Call PdhCollectQueryData before entering the section of code that you are measuring, to provide a starting value.

    Call PdhCollectQueryData again after exiting the section of code that you are measuring, to get the ending value.