How to use Sleeper to Test a Specific System Sleep State

 

Installation:

          Copy the executable sleeper.exe to the local machine.  As this is a power management test it must be run from the local machine.

Using Sleeper Topics:

  1. Why is this tool necessary?
  2. What does the option labeled ‘S4 (with reset)’ do?
  3. Is there anything different with the ‘S5 (power off)’ than going to the Start Menu and selecting Shutdown?
  4. How can I verify the machine is going into the sleep state stated on the buttons in this program?

 


Why is this tool necessary?

Simply put, to help make power management testing easier.  Windows 2000’s behavior when you select the “Stand By” option from the “Shutdown Windows” dialog is it will try to put the machine into the lowest sleep state reported by the machine.  If the request to go to that sleep state is rejected by one device driver, Windows 2000 will then try the next lightest sleep state and so on until it either a. No drivers fail the request to go to a particular sleep state or b. There are no other sleep states to try.  If the second case occurs a dialog box will come up and state which driver failed the request to go to ‘Stand By’ but there is no information stating which system sleep state that was. 

 

If you are trying to test S3 support you need some way to force the system to only try S3 and not fall back to S1.  In the past the method to do this was to run a tool called dumppo.  When you ran dumppo you would then modify the admin power policies minsleep and maxsleep states to be the sleep state you wanted to test.  Then you would select “Stand By” from the “Shutdown Windows” dialog to go to the sleep state you specified in the admin power policy.

 

This method is cumbersome and prone to mistakes, hence the need for this tool.  With this tool you simple execute the program and you will be presented with several buttons in which you can initiate the sleep action from there.


What does the option labeled ‘S4 (with reset)’ do?

This button is designed to test a scenario that currently exists in WHQL through the ACPI Stress test.  The scenario is a reset is performed at the end of writing the hibernation file instead of shutting off the system.  Since the ACPI Stress test is a required test to get WHQL certification and again it is difficult to properly set this scenario up a click of the ‘S4 (with reset)’ button will perform this task of setting up the machine to do the restart and then initiate a hibernation request.

 

 

Is there anything different with the ‘S5 (power off)’ than going to the Start Menu and selecting Shutdown?

No. This feature is provided to give the tester or developer easy access to the shutdown and off feature of power management.

 

How can I verify the machine is going into the sleep state stated on the buttons in this program?

It is actually quite simple.  The program will output to an attached debugger (kernel or user mode debugger) a string stating which sleep state it is selecting.  If the machine is going to Sx then the string is going to state “Selecting Sx” where x is the state the machine is going to. 

 

          If you want to verify what is occurring from the system’s point of view you will need to first attach a kernel debugger with the correct symbols to the systeme the test is to be run on.  Once the kernel debugger is attached break in by hitting CTRL-C.  Once at the kd> prompt enter in ‘bp hal!HalpAcpiPreSleep’ and press enter.  Now a break point is set at the last function executed before the machine goes to its sleep state.  Next hit ‘g’ to continue and then initiate the sleep state desired via the program.  When the debugger breaks in at the break point, enter in ‘!poaction’ at the kd prompt.  In the output from !poaction look for the entry labeled SystemState.  This is the sleep state that the system is going to. 

 

Below is an example debug session determining which sleep state the machine is going to when the system is going to S1:

 

kd> bp hal!HalpAcpiPreSleep

kd> g

Selecting S1

Breakpoint 0 hit

halacpi!HalpAcpiPreSleep:

8006ae88 55               push    ebp

kd> !poaction

PopAction: 80471ef0

  State..........: 3 - Set System State

  Updates........: 0

  Action.........: Sleep

  Lightest State.: Sleeping1

  Flags..........: 40000000 DisableWakes

  Irp minor......: SetPower

  System State...: Sleeping1   ß-This is the sleep state the machine is going to                      

  Hiber Context..: 00000000

 

PopAction.DevState 814f03c8

  Irp minor......: SetPower

  System State...: Sleeping1

  Worker thread..: 8153f740

  Status.........: 0

  Waking.........: FALSE

  Cancelled......: FALSE

  Ignore errors..: FALSE

  Ignore not imp.: FALSE

  Wait any.......: FALSE

  Wait all.......: FALSE

  Present Irp Q..: Head:814f0420 Empty

 

Order:

  DevNode Seq....: 5a

  NoLists........: 30

  Partial........: Head:814f03fc Empty

  Rebase.........: Head:814f03fc Empty

     7   Paged, Root-Enum

  2a 7:0 81213708 w \Driver\audstub

Feedback

We welcome your comments, problem reports and wish-list requests. Please submit them by pointing your Internet browser to http://www.microsoft.com/ddk.

© Microsoft Corporation 2000