To better understand how the Performance Counter provider works, take a close look at one of the performance classes imported into the CIM Repository by the ADAP process. The Win32_PerfRawData_PerfOS_Processor class relates to the Processor Performance category and each of its instances corresponds to one of the Processor performance objects:

[perfdefault, dynamic, provider("Nt5_GenericPerfProvider_V1"),
registrykey("PerfOS"), perfindex(238), helpindex(239),
perfdetail(100), genericperfctr]
class Win32_PerfRawData_PerfOS_Processor : Win32_PerfRawData {
[key] string Name = NULL;
[perfdefault, DisplayName("% Processor Time"),
countertype(558957824), perfindex(6), helpindex(7),
defaultscale(0), perfdetail(100)]
uint64 PercentProcessorTime;
[DisplayName("% User Time"), countertype(542180608),
perfindex(142), helpindex(143),
defaultscale(0), perfdetail(200)]
uint64 PercentUserTime;
[DisplayName("% Privileged Time"), countertype(542180608),
perfindex(144), helpindex(145),
defaultscale(0), perfdetail(200)]
uint64 PercentPrivilegedTime;
[DisplayName("Interrupts/sec"), countertype(272696320),
perfindex(148), helpindex(149), defaultscale(-2),
uint32 InterruptsPersec;
[DisplayName("% DPC Time"), countertype(542180608),
perfindex(696), helpindex(339),
defaultscale(0), perfdetail(200)]
uint64 PercentDPCTime;
[DisplayName("% Interrupt Time"), countertype(542180608),
perfindex(698), helpindex(397),
defaultscale(0), perfdetail(200)]
uint64 PercentInterruptTime;
[DisplayName("DPCs Queued/sec"), countertype(272696320),
perfindex(1334), helpindex(1335),
defaultscale(0), perfdetail(200)]
uint32 DPCsQueuedPersec;
[DisplayName("DPC Rate"), countertype(65536),
perfindex(1336), helpindex(1337),
defaultscale(0), perfdetail(200)]
uint32 DPCRate;
[DisplayName("DPC Bypasses/sec"), countertype(272696320),
perfindex(1338), helpindex(1339),
defaultscale(0), perfdetail(200)]
uint32 DPCBypassesPersec;
[DisplayName("APC Bypasses/sec"), countertype(272696320),
perfindex(1340), helpindex(1341),
defaultscale(0), perfdetail(200)]
uint32 APCBypassesPersec;

At first glance, the definition for this class seems to be very similar to that of the PerfMon_Processor class used earlier in this chapter to illustrate the operations of the Performance Monitoring provider. Indeed, the concept is the same—the class itself corresponds to the Process Performance category, while each of its properties relates to a single performance counter within the category. Yet another similarity is a key property, Name, which is set to the unique ID of the Processor instance by the provider.

However, this class, as well as all of its properties, is decorated with various qualifiers that are different from those of the PerfMon_Processor class. These qualifiers are required by the Performance Counter provider in order to locate the respective performance objects and associate them with the properties of the WMI class. The list of class qualifiers along with their descriptions is presented below.

Class Qualifiers Used by the Performance Counter Provider
If set, indicates that retrieving instances of this class is an expensive operation in terms of resource consumption. ADAP automatically adds this qualifier to a WMI class definition for a performance object that is marked as costly (see the Platform SDK documentation for more information on creating Performance Extension DLLs). Additionally, ADAP adds the _Costly suffix to the name of the WMI class. Example:

If set, indicates that the WMI class corresponds to a performance object backed by a legacy performance DLL.

Specifies the index of the object's help text in the performance names database.

Marks the WMI class as a high-performance class.

If set, indicates that the WMI class is to be used as a default selection in a list box in a graphical application.

Indicates the level of knowledge the audience is required to possess. This qualifier can take the following values:
PERF_DETAIL_NOVICE (0x00000064)—For novice users
PERF_DETAIL_ADVANCED (0x000000C8) —For advanced users
PERF_DETAIL_EXPERT (0x0000012C) —For expert users
PERF_DETAIL_WIZARD (0x00000190) —For system designers

Specifies the index of the object's display name in the performance names database.

Specifies the name of the registry subkey under HKLM\System\CurrentControlSet\Services under which the performance counter definitions are located.

Besides the qualifiers specific to the Performance Counter provider the class is marked with the Dynamic qualifier, indicating that its instances are supplied dynamically by the provider; as well as by the Provider qualifier, which establishes the link to the appropriate provider registration entry.

The actual binding between the WMI class and the respective performance counters is achieved through the property qualifiers that ADAP adds to the class definition.

Property Qualifiers Used by the Performance Counter Provider
Indicates the type of performance counter associated with a given property. Since the Performance Counter provider exposes raw, uncalculated performance data, the CounterType qualifier is used by WMI clients to determine the formula for calculating the performance values that are meaningful to the end users. A detailed description of the available counter types is presented later in this section.

The scale value used by graphical display applications such as System Performance Monitor to scale the performance chart lines.

Although this qualifier is not really specific to the Performance Counter provider, here it plays dual role. In addition to specifying the UI display name for the property, it is used to establish an association between a performance counter object and a property of its respective WMI class.

Specifies the index of the object's help text in the performance names database.

If set, indicates that WMI class property is to be used as a default selection in a list box in a graphical application.

Indicates the level of knowledge the audience is required to possess.

Specifies the index of the object's display name in the performance names database.

Most of these qualifiers are fairly self-explanatory. CounterType, however, is a key to deciphering the performance data exposed by the Performance Counter provider, and so it is a bit more complicated. As I already mentioned, this provider supplies uncalculated data, which, in its raw form, does not make much sense to the end users. For instance, the Interrupts/sec performance counter has the type of PERF_COUNTER_COUNTER (with a CounterType of 272696320), which means that at any given time, it will hold a value that reflects the total rate of interrupts for a processor. Thus, to derive the interrupt rate per second, you would have to take snapshots of the counter value over some time interval and perform the calculation based on the following formula:

Interrupts/sec = (V1 - V0)/((T1 - T0)/TB)

V1: Counter value at the end of the monitoring interval
V0: Counter value at the beginning of the monitoring interval
T1: Number of processor ticks at the end of the monitoring interval
T0: Number of processor ticks at the beginning of the monitoring interval
TB: Time base or frequency of the processor ticks

In this case, the expression (V1 – V0) evaluates to the number of interrupts that take place within a certain monitoring interval. The other expression, (T1 – T0), reflects the length of the monitoring interval in units of processor ticks. Considering that tick frequency is expressed in numbers of ticks per second; ((T1 – T0)/TB) evaluates to the number of seconds elapsed during the monitoring interval. Thus, the entire calculation yields a value that reflects an average number of processor interrupts per second.

There are many different counter types that govern the calculations of the performance values. Based on the counter usage pattern and required computation algorithm, all counter types can be divided into the following categories:

• Noncomputational counters
• Base counters
• Basic Algorithm counters
• Counter Algorithm counters
• Timer Algorithm counters
• Precision Timer Algorithm counters
• Queue-Length Algorithm counters
• Statistical counters

Source of Information : Dot NET System Management Services - Apress


Subscribe to Developer Techno ?
Enter your email address:

Delivered by FeedBurner