Platform SDK: Performance Monitoring |
The PdhGetRawCounterValue function returns the current raw value of the counter.
PDH_STATUS PdhGetRawCounterValue( HCOUNTER hCounter, LPDWORD lpdwType, PPDH_RAW_COUNTER pValue );
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 data for the counter is locked (protected) for the duration of the call to PdhGetRawCounterValue to prevent any changes during processing of the call.
Obtaining the value of rate counters such as Page faults/sec requires that PdhCollectQueryData be called twice, with a specific time interval between the two calls, before calling PdhGetRawCounterValue. Call Sleep to implement the waiting period between the two calls to PdhCollectQueryData.
Windows NT/2000: Requires Windows NT 4.0 or later.
Header: Declared in Pdh.h.
Library: Use Pdh.lib.
PdhGetFormattedCounterValue, PdhCalculateCounterFromRawValue, PdhCollectQueryData