Skip to content

Latest commit

 

History

History
142 lines (106 loc) · 4.73 KB

nf-pdh-pdhcollectquerydata.md

File metadata and controls

142 lines (106 loc) · 4.73 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:pdh.PdhCollectQueryData
PdhCollectQueryData function (pdh.h)
Collects the current raw data value for all counters in the specified query and updates the status code of each counter. (PdhCollectQueryData)
PdhCollectQueryData
PdhCollectQueryData function [Perf]
_win32_pdhcollectquerydata
base.pdhcollectquerydata
pdh/PdhCollectQueryData
perf.pdhcollectquerydata
perf\pdhcollectquerydata.htm
perf
1d83325b-8deb-4731-9df4-6201da292cdc
12/05/2018
PdhCollectQueryData, PdhCollectQueryData function [Perf], _win32_pdhcollectquerydata, base.pdhcollectquerydata, pdh/PdhCollectQueryData, perf.pdhcollectquerydata
pdh.h
Windows
Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
Pdh.lib
Pdh.dll
Windows
19H1
PdhCollectQueryData
pdh/PdhCollectQueryData
c++
APIRef
kbSyntax
DllExport
Pdh.dll
PdhCollectQueryData

PdhCollectQueryData function

-description

Collects the current raw data value for all counters in the specified query and updates the status code of each counter.

-parameters

-param hQuery [in, out]

Handle of the query for which you want to collect data. The PdhOpenQuery function returns this handle.

-returns

If the function succeeds, it returns ERROR_SUCCESS. Otherwise, the function returns a system error code or a PDH error code.

The following are possible values.

Return code Description
PDH_INVALID_HANDLE
The query handle is not valid.
PDH_NO_DATA
The query does not currently contain any counters. The query may not contain data because the user is not running with an elevated token (see Limited User Access Support).

-remarks

Call this function when you want to collect counter data for the counters in the query. PDH stores the raw counter values for the current and previous collection.

If you want to retrieve the current raw counter value, call the PdhGetRawCounterValue function. If you want to compute a displayable value for the counter value, call the PdhGetFormattedCounterValue function. If the counter path contains a wildcard for the instance name, instead call the PdhGetRawCounterArray and PdhGetFormattedCounterArray functions, respectively.

When PdhCollectQueryData is called for data from one counter instance only and the counter instance does not exist, the function returns PDH_NO_DATA. However, if data from more than one counter is queried, PdhCollectQueryData may return ERROR_SUCCESS even if one of the counter instances does not yet exist. This is because it is not known if the specified counter instance does not exist, or if it will exist but has not yet been created. In this case, call PdhGetRawCounterValue or PdhGetFormattedCounterValue for each of the counter instances of interest to determine whether they exist.

The following shows the syntax if calling this function from Visual Basic.

PdhCollectQueryData(
  ByVal QueryHandle as Long  
)
as Long

Examples

For an example, see Browsing Performance Counters or Reading Performance Data from a Log File.

-see-also

PdhGetFormattedCounterValue

PdhGetRawCounterValue