Expand Minimize

PdhComputeCounterStatistics function

Computes statistics for a counter from an array of raw values.

Syntax


PDH_STATUS PdhComputeCounterStatistics(
  _In_   PDH_HCOUNTER hCounter,
  _In_   DWORD dwFormat,
  _In_   DWORD dwFirstEntry,
  _In_   DWORD dwNumEntries,
  _In_   PPDH_RAW_COUNTER lpRawValueArray,
  _Out_  PPDH_STATISTICS data
);

Parameters

hCounter [in]

Handle of the counter for which you want to compute statistics. The PdhAddCounter function returns this handle.

dwFormat [in]

Determines the data type of the formatted value. Specify one of the following values.

ValueMeaning
PDH_FMT_DOUBLE

Return the calculated value as a double-precision floating point real.

PDH_FMT_LARGE

Return the calculated value as a 64-bit integer.

PDH_FMT_LONG

Return the calculated value as a long integer.

 

You can use the bitwise inclusive OR operator (|) to combine the data type with one of the following scaling factors.

ValueMeaning
PDH_FMT_NOSCALE

Do not apply the counter's scaling factors in the calculation.

PDH_FMT_NOCAP100

Counter values greater than 100 (for example, counter values measuring the processor load on multiprocessor computers) will not be reset to 100. The default behavior is that counter values are capped at a value of 100.

PDH_FMT_1000

Multiply the final value by 1,000.

 

dwFirstEntry [in]

Zero-based index of the first raw counter value to use to begin the calculations. The index value must point to the oldest entry in the buffer. The function starts at this entry and scans through the buffer, wrapping at the last entry back to the beginning of the buffer and up to the dwFirstEntry-1 entry, which is assumed to be the newest or most recent data.

dwNumEntries [in]

Number of raw counter values in the lpRawValueArray buffer.

lpRawValueArray [in]

Array of PDH_RAW_COUNTER structures that contain dwNumEntries entries.

data [out]

A PDH_STATISTICS structure that receives the counter statistics.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code or a PDH error code. The following are possible values.

Return codeDescription
PDH_INVALID_ARGUMENT

An argument is not correct or is incorrectly formatted.

PDH_INVALID_HANDLE

The counter handle is not valid.

 

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Pdh.h

Library

Pdh.lib

DLL

Pdh.dll

See also

PdhCalculateCounterFromRawValue
PdhGetRawCounterValue
PDH_RAW_COUNTER
PdhSetCounterScaleFactor
PDH_STATISTICS

 

 

Community Additions

ADD
Show:
© 2014 Microsoft