Platform SDK: Performance Monitoring

PdhSetCounterScaleFactor

The PdhSetCounterScaleFactor function sets the scale factor that is applied to the calculated value of the specified counter when you request the formatted counter value. If the PDH_FMT_NOSCALE flag is set, then this scale factor is ignored.

PDH_STATUS PdhSetCounterScaleFactor(
  HCOUNTER hCounter,  
  LONG lFactor        
);

Parameters

hCounter
[in] A handle to the counter to receive the scale factor.
lFactor
[in] The power of ten by which to multiply the calculated value before returning it. The valid range of this parameter is PDH_MIN_SCALE (–7) (the returned value is the actual value times 107) to PDH_MAX_SCALE (+7) (the returned value is the actual value times 10+7). A value of zero will set the scale to one, so that the actual value is returned.

Return Values

If the function succeeds, it returns ERROR_SUCCESS.

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

Error value Description
PDH_INVALID_ARGUMENT The scale value is out of range.
PDH_INVALID_HANDLE The counter handle is not valid.

Requirements

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

See Also

PdhCalculateCounterFromRawValue, PdhComputeCounterStatistics, PdhGetFormattedCounterValue