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(
  IN HCOUNTER hCounter,  // handle of the counter
  IN LONG lFactor        // power of ten used to multiply value
);
 

Parameters

hCounter
The handle of the counter to receive the scale factor in lFactor.
lFactor
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:

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

See Also

Performance Data Helper Overview, Performance Data Functions, , PdhCalculateCounterFromRawValue, PdhComputeCounterStatistics, PdhGetFormattedCounterValue