Platform SDK: Performance Monitoring

PdhCollectQueryDataEx

The PdhCollectQueryDataEx function samples the current raw data value for all counters in the specified query according to the specified time interval, and updates the status code of the counter. After the time interval has expired, the specified event is signaled.

PDH_STATUS PdhCollectQueryDataEx(
  HQUERY hQuery,            
  DWORD dwIntervalTime,     
  HANDLE hNewDataEvent      
);

Parameters

hQuery
[in] A handle to the query.
dwIntervalTime
[in] The time interval, in seconds, between samplings of the input performance data. A value of 0 or less will terminate all current data collection threads.
hNewDataEvent
[in] A handle to the event to be set when performance data is present. If you do not want to receive this notification, you must set the value of this parameter to NULL.

Return Values

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a PDH error status defined in PDHMsg.h. The following are possible error values.

Error value Description
PDH_INVALID_HANDLE The query handle is not valid.
PDH_NO_DATA The query does not currently have any counters.

Remarks

This function is designed to return successfully while no data is available. For this reason, check the event specified by the value of hNewDataEvent to ensure that a value exists for all of the counters in the query.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Pdh.h.
  Library: Use Pdh.lib.

See Also

Synchronization Functions, PdhCollectQueryData, CreateEvent