Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The state information that is required for successful operation of the Performance Counter Query Protocol is primarily stored on the server; other than the handle that is obtained from the PerflibV2OpenQueryHandle (section 3.1.4.1.4) method, all information such as the list of performance counters being queried is stored on the server.
If the client simply wants to either enumerate the available countersets or counterset instances on the server, or retrieve information about the counterset or counters that belong to the counterset, it does not need to establish a handle with the server by calling the PerflibV2OpenQueryHandle method. The client can simply call the PerflibV2EnumerateCounterSet (section 3.1.4.1.1), PerflibV2EnumerateCounterSetInstances (section 3.1.4.1.3), or PerflibV2QueryCounterSetRegistrationInfo (section 3.1.4.1.2) methods to retrieve the necessary information from the server.
If the client wants to query for performance counter data, or performance counter metadata associated with a particular query, from the server, then it first creates a handle. The client creates a handle by calling the PerflibV2OpenQueryHandlemethod. The server, upon receiving this call, stores the client machine information it receives from the RPC layer. The server also uses this handle to associate back to the client the performance counter2 that the client adds to the query by calling PerflibV2ValidateCounters (section 3.1.4.1.7). The server then returns this handle back to the client. The purpose of the handle is for the server to be able to distinguish between different client performance counter queries; the information that is passed back to the client, in the form of an RPC_HQUERY (section 2.2.1) handle, only contains the information necessary for the server to distinguish between separate queries. The client does not have knowledge of the contents or structure of the handle. For example, a specific implementation of the Performance Counter Query Protocol MAY return back a 32-bit unsigned numeric identifier as an RPC_HQUERY handle to the client; the client will then use this RPC_HQUERY handle, without explicit knowledge that the representation is a 32-bit unsigned integer, in subsequent communication to the server to query for performance counter data.
When the client has completed its necessary communication with the server, it closes the handle it obtained from the server by calling PerflibV2CloseQueryHandle. This allows the server to free any information it retained with respect to the client's query (such as the list of performance counters that were being queried). The client can also free the memory that is associated with the RPC_HQUERY handle.