Platform SDK: Performance Monitoring

PdhGetDataSourceTimeRange

The PdhGetDataSourceTimeRange function determines the time range, number of entries and, if applicable, the size of the buffer containing the performance data from the specified input source.

PDH_STATUS PdhGetDataSourceTimeRange(
  LPCTSTR szDataSource,     
  LPDWORD pdwNumEntries,    
  PPDH_TIME_INFO pInfo,     
  LPDWORD dwBufferSize      
);

Parameters

szDataSource
[in] A pointer to a null-terminated string containing the name of a log file that performance data will be taken from.
pdwNumEntries
[out] A pointer to a DWORD that receives the number of performance data collection sessions. The value of this parameter is always 1. This means that only one group of performance data can be collected for each call to PdhGetDataSourceTimeRange.
pInfo
[out] A pointer to a PDH_TIME_INFO structure that receives the time range.
dwBufferSize
[in] A pointer to a DWORD containing the size, in bytes, of the pInfo buffer.

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_ARGUMENT An argument is not correct or is incorrectly formatted.
PDH_INVALID_HANDLE The counter handle is not valid.

The following are possible non-error return values.

Value Description
PDH_DATA_SOURCE_IS_REAL_TIME The current data source is a real-time data source.

Remarks

If the current data source is a real-time data source, a PDH_DATA_SOURCE_IS_REAL_TIME value is returned and no action is performed by this function.

The SampleCount member of the PDH_TIME_INFO structure, which the pInfo parameter points to, contains the number of samples collected during the time interval.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Pdh.h.
  Library: Use Pdh.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows 2000.

See Also

PdhSetQueryTimeRange