PerfOpenQueryHandle function (perflib.h)

Creates a handle that references a query on the specified system. A query is a list of counter specifications.

Syntax

ULONG PerfOpenQueryHandle(
  [in, optional] LPCWSTR szMachine,
  [out]          HANDLE  *phQuery
);

Parameters

[in, optional] szMachine

The name of the machine for which you want to get the query handle.

[out] phQuery

The handle to the query. Call PerfCloseQueryHandle to close ths handle when you no longer need it.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code.

Remarks

Use PerfAddCounters and PerfDeleteCounters to add or remove counter specifications to the list. Use PerfQueryCounterInfo to get the counter specifications currently in the list and to determine the indexes at which the data for each counter will be returned by PerfQueryCounterData. Use PerfQueryCounterData to retrieve the values of the counters that match the counter specifications.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1607 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header perflib.h
Library AdvAPI32.lib
DLL AdvAPI32.dll

See also

PerfAddCounters

PerfCloseQueryHandle

PerfDeleteCounters

PerfQueryCounterData

PerfQueryCounterInfo