4.1 Querying for Performance Counter Data

Querying for performance counter data

Figure 10: Querying for performance counter data

  1. The client calls PerflibV2EnumerateCounterSet on the server.

  2. The server returns all the available countersets to the client.

  3. The client selects a counterset based on GUID and calls PerflibV2QueryCounterSetRegistrationInfo by using RequestCode = 0x00000001.

  4. 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.

  5. To query the performance counter data of certain counters, the client calls PerflibV2OpenQueryHandle to open a handle to a query on the server.

  6. The server returns a handle to a query; the client uses this handle to specify the performance counters whose values are to be queried.

  7. The client, using the information that was returned from PerflibV2QueryCounterSetRegistrationInfo, specifies the performance counters from the counterset that are to be queried.

  8. 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.

  9. The server adds the performance counter information to the query that is specified by the handle and returns.

  10. The client calls PerflibV2QueryCounterData to retrieve the values of the performance counters that are stored in the query that is specified by the handle.

  11. The server returns the values of the performance counters in the query that is specified by the handle.

  12. The client calls PerflibV2CloseQueryHandle to close the handle that it obtained in step 6 because it is finished querying the server.

  13. The server releases all resources that are associated with the query that is specified by the handle and returns.