Читаем Windows® Internals, Sixth Edition, Part 2 полностью

Decisions taken by the PPM engine as to whether to modify the power state of a core, as well as which cores to park or unpark, are gated by one primal metric: utility. The utility of a processor represents, in the engine’s view, the load of a given core and is computed by multiplying the average frequency of a core (expressed as a percentage of its maximum) by the busy period of the core (expressed as a percentage of non-idle time). Because two percentages are being multiplied, the maximum utility is 10,000, and almost all the engine’s calculations are done by comparing utility (actually, as we show later, a value derived from utility) with some threshold or average.

Note

On modern processors, the average frequency is obtained by invoking the feedback handler associated with the current power domain, which is managed by the vendor-supplied power management driver (such as Intelppm.sys). If a feedback mechanism is not available, the current domain’s frequency is used instead.

Because the utility of a processor can, obviously, change rapidly over time, the engine builds a history of the utilities of each core, as well as a core’s average frequency. It also keeps a running sum of the utilities added up over time, such that the final averaged utility is calculated as the running sum divided by the number of history entries.

EXPERIMENT: Viewing Utility and Frequency Information

As with most other PPM-related information, the KPRCB stores information on the current utility as well as the utility history. Furthermore, a few debugger extensions are also available to easily visualize PPM utility information.

When you run the !ppm kernel debugger command, you should see output similar to the following, which shows information for LP 0:lkd> !ppm Processor 0 Idle States (3) 0: C1 - intelppm 1: C2 - intelppm 2: C3 - intelppm Last Used Idle State: 2 Current Frequency: 100% HardwareFeedback: 55% Maximum Policy: 100% Platform Cap: 100% Minimum Policy: 5% Minimum Performace: 44% Minimum Throttle: 5% Utility: 5400

Highlighted in bold are the three values that were described earlier. The utility of this processor is 5400, and it is currently running at 100 percent of its maximum frequency. The hardware feedback is the average frequency from the feedback handler described previously, which the Intelppm.sys vendor-supplied PPM driver has calculated as 55 percent on this processor.

You can also look at the PPM information for other processors while in a remote debugging session by using the ~ (tilde) command to switch processors. When using the local kernel debugger, you have to dump the KPRCB structure manually and list the .PowerState substructure, as shown in the following output. In this example, the PPM state for LP 1 is dumped.lkd> !running -i System Processors: (0000000f) Idle Processors: (0000000a) Prcbs Current (pri) Next (pri) Idle 0 8376cd20 87f0b030 (12) 83776380 ................ 1 8b404120 8b409800 ( 0) 8b409800 ................ 2 8b43a120 86e6ed48 (11) 8b43f800 ................ 3 8b470120 8b475800 ( 0) 8b475800 ................ lkd> dt nt!_KPRCB 8b404120 PowerState. +0x33a0 PowerState : +0x000 IdleStates : 0x877ff890 _PPM_IDLE_STATES +0x008 IdleTimeLast : 0xed +0x010 IdleTimeTotal : 0xadae7baa ...

EXPERIMENT: Viewing Utility and Frequency History

If the current core parking policy enables history tracking (which is normally disabled on client systems), you can also see the utility function over time, as well as the frequency. To do so, a different kernel extension has to used, !ppmstate.

Here’s the output of !ppmstate on a server system with core parking enabled:lkd> !ppmstate Prcb.PowerState - 0x837700c0 IdleStates: 0x877fe1b0 IdleTimeLast: 0.000.006us (0x860 ) IdleTimeTotal: 11:35.968.474us (0x6bc4ae5f ) IdleAccounting: 0x874d8008 Hypervisor State: 0x0 LastPerfCheck: 13:20.311.497us (0x7becdf55) PerfDomain: 0x874d9c50 PerfConstraint: 0x874d9cc8 Utility: 0xf6c PerfHistory: 0x88604300 PerfHistory contents (3 slots, oldest to newest) Slot Utility Frequency 0 3435 82% 1 10800 108% 2 10900 109% ThermalConstraint: 100% PerfActionDPC: 0x83770120 PerfActionMask: 0x0 WmiDispatchPtr: nt!PpmWmiDispatch WmiInterfaceEnabled: 0x1 CurrentKernelUserTime: 0xc59e CurrentIdleThreadKTime: 0xb556

Перейти на страницу:

Похожие книги