Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

PdhCalculateCounterFromRawValue function

Calculates the displayable value of two raw counter values.

Syntax


PDH_STATUS PdhCalculateCounterFromRawValue(
  _In_  PDH_HCOUNTER          hCounter,
  _In_  DWORD                 dwFormat,
  _In_  PPDH_RAW_COUNTER      rawValue1,
  _In_  PPDH_RAW_COUNTER      rawValue2,
  _Out_ PPDH_FMT_COUNTERVALUE fmtValue
);

Parameters

hCounter [in]

Handle to the counter to calculate. The function uses information from the counter to determine how to calculate the value. This handle is returned by the PdhAddCounter function.

dwFormat [in]

Determines the data type of the calculated 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 factor 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.

 

rawValue1 [in]

Raw counter value used to compute the displayable counter value. For details, see the PDH_RAW_COUNTER structure.

rawValue2 [in]

Raw counter value used to compute the displayable counter value. For details, see PDH_RAW_COUNTER. Some counters (for example, rate counters) require two raw values to calculate a displayable value. If the counter type does not require a second value, set this parameter to NULL. This value must be the older of the two raw values.

fmtValue [out]

A PDH_FMT_COUNTERVALUE structure that receives the calculated counter value.

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.

 

Remarks

To retrieve the current raw counter value from the query, call the PdhGetRawCounterValue function.

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

PDH_FMT_COUNTERVALUE
PDH_RAW_COUNTER
PdhGetFormattedCounterValue
PdhGetRawCounterValue
PdhSetCounterScaleFactor

 

 

Community Additions

ADD
Show:
© 2015 Microsoft