Platform SDK: Performance Monitoring

PdhSetQueryTimeRange

The PdhSetQueryTimeRange function specifies the timeframe performance data will be collected for the specified query. This query refers to a log file that has been opened for reading.

PDH_STATUS PdhSetQueryTimeRange(
  HQUERY hQuery,            
  PPDH_TIME_INFO pInfo      
);

Parameters

hQuery
[in] A handle to the query.
pInfo
[in] A pointer to a PDH_TIME_INFO structure containing the time range.

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 An invalid handle was specified.
PDH_INVALID_ARGUMENT A time earlier than the starting time range value was specified as the ending time range value.

Remarks

When the end of the specified time range or the end of the log file is reached, the PdhCollectQueryData function will return PDH_NO_MORE_DATA.

Requirements

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

See Also

PdhGetDataSourceTimeRange, PdhCollectQueryData