/*++ Copyright (C) 1995-1999 Microsoft Corporation Module Name: compose.c Abstract: Counter composition functions --*/ #include #include //#include #include //#include "pdhitype.h" #include "pdhidef.h" //#include "pdhicalc.h" double WINAPI PdhAverage( IN double *CounterArray, IN ULONG nEntries ) { double sum = 0; if ((CounterArray == NULL) || (nEntries == 0)) return PDH_INVALID_ARGUMENT; __try { ULONG i; for (i=0; i 0.0) sum += CounterArray[i]; } } __except (EXCEPTION_EXECUTE_HANDLER) { SetLastError( GetExceptionCode() ); } return (sum / (double) nEntries); } double WINAPI PdhMax( IN double *CounterArray, IN ULONG nEntries ) { double max = 0; if ((CounterArray == NULL) || (nEntries == 0)) return PDH_INVALID_ARGUMENT; __try { ULONG i; for (i=0; i CounterArray[i]) min = CounterArray[i]; } } __except (EXCEPTION_EXECUTE_HANDLER) { SetLastError( GetExceptionCode() ); } return (min); } double WINAPI PdhNormalizeCpu( IN double *CounterArray, IN ULONG nEntries ) { double sum = 0; if ((CounterArray == NULL) || (nEntries == 0)) return PDH_INVALID_ARGUMENT; __try { ULONG i; for (i=0; i 0.0) sum += CounterArray[i]; // need to get weight of array } } __except (EXCEPTION_EXECUTE_HANDLER) { SetLastError( GetExceptionCode() ); } return (sum / (double) nEntries); }