Welcome to DynData, A collection of freeware MFC classes to encapsulate the performance counters as stored under the HKEY_DYN_DATA registry key on Windows 9x. Please note that these classes are not designed to be used on NT, 2000, XP, 2003, Vista. If you would like to retrieve performance stats on these operating systems, please see the author's CPdh wrapper classes.
Features |
Copyright |
Usage |
History |
API Reference |
Contacting the Author |
V1.0 (31 January 1999)
V1.01 (10 January 2007)
The DynData classes provide the following functions:
CDynDataObject::CDynDataObject
CDynDataObject::EnumCounters
CDynDataEnumerator::EnumObjects
CDynDataCounter::Start
CDynDataCounter::Collect
CDynDataCounter::Stop
CDynDataObject::CDynDataObject
CDynDataObject::CDynDataObject(LPCTSTR pszObjName,
HKEY hObjectKey);
CDynDataObject::CDynDataObject(LPCTSTR pszObjName,
LPCTSTR pszComputerName);
Parameters
pszObjName This is the name of the performance object e.g. "Dial-Up Adapter" or "Kernel".
hObjectKey This is the registry key which represents the performance object.
pszComputerName This is the name of the computer on which to open the performance object. Set this value to NULL to open the object on the local machine.
Remarks
Constructs a performance object which can be later used for enumeration. The first version of the constructor is used internally by the CDynDataEnumerator class. Normally to enumerate the counters which an object has you would use the second version. Another point to bear in mind is that since the two constructors look pretty much identical, you will need to cast the NULL to a LPCTSTR if you are calling the second constructor yourself.
BOOL CDynDataObject::EnumCounters(ENUMERATE_DYNDATA_OBJECT_COUNTERS lpEnumFunc, DWORD_PTR dwItemData = 0);
Parameters
lpEnumFunc The function to be used as the call-back when enumerating the counters which this object has.
dwItemData This is a DWORD_PTR which can be anything you want and will be sent to the call-back function.
Return Value
TRUE if at least one counter was successfully enumerated for the performance object otherwise FALSE.
Remarks
The call-back function is of the form:
typedef BOOL (*ENUMERATE_DYNDATA_OBJECT_COUNTERS)(DWORD_PTR dwItemData, CDynDataObject&
object, const CString& sRegistryName, const CString& sCommonName, const CString&
sDescription, BOOL bDifferentiate);
The dwItemData is the value as presented in the EnumCounters function.
The object parameter represents the performance object being enumerated.
The sRegistryName is the name of the counter as stored in the registry.
The sCommonName is the name of the counter which you would display to an end user.
The sDescription is a description of the counter.
If bDifferentiate is TRUE, then the counter represents a rate such as Bytes Received per Second as opposed to an absolute value such as bytes sent.
Returning TRUE from the call-back function will continue the enumeration while returning FALSE will cause the enumeration to stop.
CDynDataEnumerator::EnumObjects
BOOL CDynDataEnumerator::EnumObjects(ENUMERATE_DYNDATA_OBJECTS lpEnumFunc, DWORD_PTR dwItemData = 0, LPCTSTR pszComputerName = NULL);
Parameters
lpEnumFunc The function to be used as the call-back when enumerating the performance objects.
dwItemData This is the value as presented in the EnumObjects function.
pszComputerName This is the name of the computer of which to enumerate the performance objects. Set this value to NULL to enumerate the objects on the local machine.
Return Value
TRUE if at least one object was successfully enumerated otherwise FALSE.
Remarks
The call-back function is of the form:
typedef BOOL (*ENUMERATE_DYNDATA_OBJECTS)(DWORD_PTR dwItemData, CDynDataObject&
object);
The dwItemData is the value as in the EnumObjects function.
The object parameter represents the current performance object being enumerated.
Returning TRUE from the call-back function will continue the enumeration while returning FALSE will cause the enumeration to stop.
BOOL CDynDataCounter::Start(LPCTSTR pszObjName pszObjName, LPCTSTR pszCounterName, LPCTSTR pszComputerName = NULL);
Parameters
pszObjName The name of the performance object e.g. "KERNEL".
pszCounterName The name of the counter for the performance object e.g. "CPUUsage".
pszComputerName This is the name of the computer on which the counter is to be collected. Set this value to NULL to start collection on the local machine.
Return Value
TRUE if collection of the performance data was started otherwise FALSE.
Remarks
Starts collection of the performance data.
BOOL CDynDataCounter::Collect(DWORD& dwData);
Parameters
dwData Upon successful return of the function this will contain the actual value of the performance counter.
Return Value
TRUE if collection of the performance data was successful otherwise FALSE.
Remarks
Retrieves the current value of the performance counter.
BOOL CDynDataCounter::Stop();
Return Value
TRUE if collection of the performance data was successfully stopped otherwise FALSE.
Remarks
Stops retrieval of the performance counter.
PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
10 January 2007