Performance Libraries and WMI
Starting with Windows Vista, the WMIPerfClass Provider and the WMIPerfInst Provider dynamically provide performance counter data for the WMI Performance Counter Classes. The AutoDiscovery/AutoPurge (ADAP) process is not required.
Windows Server 2003 and Windows XP: The WMI AutoDiscovery/AutoPurge (ADAP) process transfers performance counter objects into Win32_PerfRawData and Win32_PerfFormattedData classes in the WMI repository. The properties of these classes represent the counters for a performance object. You can use the wmiadap command for several functions.
The following sections are discussed in this topic:
WMIPerfClass Provider creates WMI Performance Counter Classes at system initialization. The WMIPerfInst Provider dynamically provides performance counter data for these classes. The WMIPerfClass Provider provider supplies classes for both version 1 and version 2 Performance Counters.
Version 1 counters are found in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services. Services that provide performance data have a Performance subkey. WMI performance classes created from version 1 counters do not have "Counters" as part of their name.
The GUIDs identifying a version 2 performance counter provider are found in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\_V2Providers.
WMIPerfClass is registered as a normal WMI class provider. WMIPerfInst is a WMI instance provider that supplies data from Performance Data Helper (PDH) for both version 1 and version 2 counters. For more information, see Using the PDH Functions to Consume Counter Data.
In operating systems earlier than Windows Vista, the ADAP process parses the performance libraries to build the Win32_PerfRawData and Win32_PerfFormattedData classes in the WMI repository. Starting with Windows Vista, ADAP runs only when Wmiadap.exe is run at a command prompt. For more information, see Wmiadap.
Windows Server 2003 and Windows XP: ADAP is a separate process, Wmiadap.exe. ADAP detects when a user installs a new performance library or removes one. When a new performance library is found, ADAP then adds a related performance object to the root\cimv2 namespace or to the root\wmi namespace for WDM drivers. You can verify the current state of the ADAP process by examining the Status property of the __ADAPStatus system class. For more information about running ADAP from the command line, see Wmiadap.
The ADAP process compares the list of counter objects found in the performance libraries to the list of counter classes contained in WMI. Counter objects that currently do not exist in WMI are added. Existing WMI performance classes are compared to the corresponding performance library counter objects, and are replaced if differences are detected.
A WMI counter class is only deleted if ADAP detects that the performance library that contains the counter object has been uninstalled. All the WMI performance classes that derive from the registered performance libraries have the class qualifier genperfctr set to TRUE. For more information, see Qualifiers Specific to WMI Performance Classes.
ADAP runs when:
- The operating system starts.
- The net stop/start winmgmt is run at a command prompt.
- A performance library changes.
- Either lodctr, unlodctr, or Winmgmt /resyncperf are run at a command prompt.
- A new Windows Driver Model (WDM) driver is added or removed.
- Wmiadap is run at a command prompt.
Errors generated by ADAP can appear in two places: the Event Viewer and the WMI application event logs. Events during the run of ADAP, such as starting and stopping the Reverse Adapter process, are logged by WMI in Windows\System32\Wbem\Logs\Wmiadap.log.
Errors related to the transfer of performance libraries can be seen in the Event Viewer, Eventvwr.exe. Run Eventvwr and select Application. Look in the Source column for "Winmgmt". This log will provide an explanation for why a WMI class corresponding to a performance object fails to appear in the WMI repository after ADAP runs. For example, if a performance library is inactive, ADAP does not reflect the objects in that performance library into the WMI repository.
In addition, use the system class __ADAPStatus to determine the run status of ADAP programmatically. The three local properties LastStartTime, LastStopTime, and Status in the instance __ADAPStatus=@ in the \root\default namespace provide data on the most recent run of ADAP.