4.1 Querying for Performance Counter Data
Figure 10: Querying for performance counter data
The client calls PerflibV2EnumerateCounterSet on the server.
The server returns all the available countersets to the client.
The server returns the counterset information of the counterset that is specified by the GUID in PerflibV2QueryCounterSetRegistrationInfo, in addition to information about the performance counters that belong to the counterset.
To query the performance counter data of certain counters, the client calls PerflibV2OpenQueryHandle to open a handle to a query on the server.
The server returns a handle to a query; the client uses this handle to specify the performance counters whose values are to be queried.
The client, using the information that was returned from PerflibV2QueryCounterSetRegistrationInfo, specifies the performance counters from the counterset that are to be queried.
The client calls PerflibV2ValidateCounters with the dwAdd parameter set to TRUE to add the counters to the query that is specified by the handle that is returned in step 6.
The server adds the performance counter information to the query that is specified by the handle and returns.
The client calls PerflibV2QueryCounterData to retrieve the values of the performance counters that are stored in the query that is specified by the handle.
The server returns the values of the performance counters in the query that is specified by the handle.
The client calls PerflibV2CloseQueryHandle to close the handle that it obtained in step 6 because it is finished querying the server.
The server releases all resources that are associated with the query that is specified by the handle and returns.