• Re: Hibernation

    From Graham J@21:1/5 to jason_warren@ieee.org on Fri Apr 21 16:50:53 2023
    jason_warren@ieee.org wrote:
    In the nice-to-know department...
    Entering Hibernation mode on my speedy laptop
    used to take five seconds. Now it's taking 20.
    There have been several Windows updates so I
    suspect that may be the reason, but it got me
    wondering: is there a way to record what's going
    on during that interval? The screen goes blank
    as soon as I click.

    Reviewing the event log may tell you what processes were activated after
    you started the hibernation.


    --
    Graham J

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jason_warren@ieee.org@21:1/5 to All on Fri Apr 21 11:34:51 2023
    In the nice-to-know department...
    Entering Hibernation mode on my speedy laptop
    used to take five seconds. Now it's taking 20.
    There have been several Windows updates so I
    suspect that may be the reason, but it got me
    wondering: is there a way to record what's going
    on during that interval? The screen goes blank
    as soon as I click.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul@21:1/5 to jason_warren@ieee.org on Fri Apr 21 13:49:09 2023
    On 4/21/2023 11:34 AM, jason_warren@ieee.org wrote:
    In the nice-to-know department...
    Entering Hibernation mode on my speedy laptop
    used to take five seconds. Now it's taking 20.
    There have been several Windows updates so I
    suspect that may be the reason, but it got me
    wondering: is there a way to record what's going
    on during that interval? The screen goes blank
    as soon as I click.


    Let's say you have 64GB of RAM.

    The hibernation operation does not record all 64GB of it.

    To start with, the physical hiberfile will be somewhat smaller,
    such as 48GB. Hibernation uses a lightweight compressor,
    when recording stuff in the hiberfile. If you regularly do
    demanding things from a hibernation perspective, you can
    adjust that back to the full 64GB if you want (match byte for
    byte, give it a tiny bit extra so every last system feature
    would work).

    Hibernation records the "allocated memory". The kernel
    might need 350MB. The desktop might not need much. The
    result is, for a mostly idle system, you can write out
    the allocations in five seconds.

    When you go to Programs and Features : Windows Features
    and turn some of the "features" on, this can increase the size
    of allocations in the system. Perhaps the 2.6GB mini-OS
    image used for sandboxing, the system is fooled into writing
    that out.

    In the pathological case for my other system and its slow
    storage, I worked out it would take eight minutes worst case,
    to hibernate.

    You should be thankful it is only 20 seconds :-)

    *******

    Process Monitor from sysinternals, if it is running and
    capturing a trace at shutdown, the trace can be recovered
    on the next startup. In addition, if you select the Boot Trace
    option, a second trace file starts at system boot, and records
    activity for two minutes or so at boot time.

    Thus, two trace files can be captured, giving some idea what
    is happening at application level.

    But the ETW tracing system has limits on when it runs and
    what it captures. And ferreting out what happens during
    actual hibernation, that's not going to happen. At that time,
    Ring 3 is pretty well shut down, and the writing of the hibernation
    file may be done by something in the kernel.

    The hiberfile has a header. The header indicates what percentage
    of it is occupied. Space is "reserved" for the hiberfile, to
    ensure whatever writes out hiberfiles, has a place to work. Most
    of the time, the reserved space is not being written. Maybe 2GB
    out of 48GB hiberfile is being used. Obviously, pathologically,
    the whole thing gets used. A VHDL chip simulation, currently running when
    you selected "hibernate", might be an example of something
    while will fill (and exhaust) the hiberfile. Or, you can write your
    own 20 line C code program, to overwhelm hibernation if you want :-)

    Right off hand, I cannot visualize in my mind, what application
    provides an exact "map" of hibernate-able goodies. There are memory
    map applications, but they tend to be a bit crazy in design, and
    not all that useful to an end-user looking for a quick answer or two.
    I don't need to see ten thousand individual entries, at a time
    like that. Too much granularity.

    I have not seen any nice block diagrams lately, which would
    help an end-user understand what exactly is under the hood.
    Sure, there's a stack and a heap... and a whole lot more rubbish :-)
    Even if WSL2/WSLg Bash shell was running, that might need to be
    hibernated as well.

    Paul

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From VanguardLH@21:1/5 to jason_warren@ieee.org on Fri Apr 21 12:55:11 2023
    "jason_warren@ieee.org" <jason_warren@ieee.org> wrote:

    Entering Hibernation mode on my speedy laptop used to take five
    seconds. Now it's taking 20. There have been several Windows updates
    so I suspect that may be the reason, but it got me wondering: is
    there a way to record what's going on during that interval? The
    screen goes blank as soon as I click.

    The more processes (programs, apps) you have running, the more memory
    that is occupied and has to be written to a file. More writes take more
    time. Also, the more processes that are running, the more that get a
    request to pause, and wait for them to pause, to have a stable memory
    image to copy to a file. Some processes are more responsive than
    others. Do you really need all those processes running again when you un-hibnerate?

    Have you performed any disk maintainance. You did not mention the type
    of storage media to where the hiberfil.sys file gets written. Could be
    HDD or SDD. For HDD, have you ran a 'chkdsk /r' to ensure all its
    sectors are in good condition? Have you defragged your HDD?

    Did you used to use hibernate before, or did you use hybrid sleep?
    Hybrid sleep does not fully shutdown the OS. The hyberfil.sys hibernate
    file gets written, but there is no shutdown process. Instead the
    computer goes into a low-power state. If there is no power outage, the computer remains in sleep mode ready to awaken very quickly (no need to
    read the hiberfil.sys file into memory). If there is a power loss, the hiberfile.sys file is available to restore the memory image. With
    hybrid sleep, there is no time spent waiting to suspend processes or to shutdown the OS.

    Did you add more system memory? The more there is, the more time it
    takes to write it to a file. The hiberfil.sys file size is about 40%
    the size of the system memory. There is some compression. On my system
    with 64 GB of system RAM, the hiberfil.sys is 26 GB in size. That is a
    huge file.

    <Aside> I don't ever hibernate my desktop PC, but shut it down if I
    won't be using it for awhile, like when away on vacation. Else, I
    leave it running 24x7. I don't even have it go into low-power mode,
    but some users want that (save a few pennies on lower power
    consumption, but it's trivial to me). If it were a mobile device
    instead of a desktop PC, and it used HDDs (spinners) instead of SSDs,
    yeah, I'd have it go into low-power mode to stop the HDDs from
    spinning. The gyro effect of spinning HDDs is why I use SSDs in
    mobile computers. I don't have to remember to sleep before moving the
    mobile computer. I really should disable hibernation, and delete that
    huge hiberfil.sys file. Also, for an SSD (I have a 2 TB NVMe SSD m.2
    memory card), 25GB is a hell of a lot of writes to stress the SSD
    (flash memory has a maximum number of writes until catastrophic
    failure). I don't do hibernate, so the old 25GB hiberfil.sys is
    almost 3 years old. With an SSD, resuming from hibernation or
    starting cold isn't a lot of difference in load time; however, before
    I shutdown the OS, I usually exit all programs or apps, so there is
    nothing to restore of them on resuming from hibernate. I reviewed by
    power options for each profile, and made sure hibernate was "Never" in
    all of them. I then ran "powercfg /hibernate off" to disable
    hibernate. The 25GB hiberfil.sys file disappeared. </Aside>

    How much free space remains on the storage device where the hiberfil.sys
    file gets written?

    How long has hibernation taken longer? If this is a one-time scenario,
    could be those OS updates have to complete. Just because an update
    doesn't mandate an immediate OS restart does not mean a restart is
    unnecessary to complete the update. Plus hibernation might interfere
    with completion of updates. You have not restarted the OS when using hibernation. You resume its prior state. Do at least one, if not two, complete shutdowns with cold starts of the OS to ensure all updating has completed. Then check how long hibernation takes.

    You said the screen goes completely blank when you hibernate. Up to
    Windows XP, there was a hibernate screen. From Windows Vista, and
    later, there is no hibernate informational screen showing progress.
    However, you should see a "Resuming" screen when resuming from
    hibernation when Windows starts. The following Youtube video shows what
    you should see for hibernation screens (before Vista) and resume
    screens:

    https://www.youtube.com/watch?v=B4OcIvaGJe0

    Tis possible something might be crashing or stalling when requested to
    stop to a steady state (suspend). As Graham mentioned, look in the
    Event Viewer at the events at the time you hibernated to see if any
    processes are crashing. Alas, it won't tell you if they are stalling (unresponsive) on shutdown.

    Instead of seeing a blank screen upon hibernating, you could switch to
    verbose mode. In the registry, go to:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

    and right-click on that key to use New -> DWORD to add a value under
    that registry key. Name the new data item as "verbosestatus", and set
    its value to 1. On shutdown (part of hibernation), later go into Event
    Viewer under Applications and Service Logs -> Microsoft -> Windows -> Diagnostics-Performance -> Operational, and check for any odd event
    entries. Click on the Tasks column to sort by that category to look at
    the shutdown events. Look for errors. Sorry, that's where my expertise
    ends. I would have to research each error to determine if it were a
    problem, or not. For example, I see an error on the DHCP Client, but I
    don't care during a shutdown if that service failed to stabilize itself
    since it will have to reinitialize on Windows startup. Of course I'm
    going to lose by IP bind when I shutdown. More (different) info at:

    https://learn.microsoft.com/en-us/troubleshoot/windows-server/performance/enable-verbose-startup-shutdown-logon-logoff-status-messages

    While I gave the registry entry, all policies are registry entries. If
    you have a Pro or Enterprise edition of Windows, you can use the policy
    editor (gpedit.msc) to look at and configure policies. You didn't
    mention which edition of Windows 10 that you have. Some folks prefer
    not messing inside the registry, and use the policy editor, it they have
    it which depends on which edition of Windows you have.

    Another choice is to install some software, like:

    https://learn.microsoft.com/en-us/windows-hardware/test/wpt/windows-performance-recorder

    Another method I read about is using SysInternals' (now owned by
    Microsoft) psexec and procmon tools. You can run them using /? to get
    help, like "psexec /?". Open a command shell (cmd.exe) under admin
    privileges, and then run:

    psexec -s cmd

    That opens yet another command shell, but under the System account which
    has full privileges (admins do not get full privs). You create a new
    folder, like C:\mstrace, move to it (cd C:\mstrace), and start procmon
    to monitor the events:

    procmon /backingfile C:\mstrace\logfile.pml /NoFilter /AcceptEula Minimized /Quiet

    and do a shutdown. If hibernating is slow on the shutdown, so will a
    normal shutdown be slow. On restart of Windows, review the .pml logs in C:\mstrace\.

    Good luck understanding all the stuff in the logs, but that's what you
    asked for.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jason_warren@ieee.org@21:1/5 to All on Fri May 5 09:06:22 2023
    In article <190q7ywfch3tu.dlg@v.nguard.lh>, V@nguard.LH says...

    "jason_warren@ieee.org" <jason_warren@ieee.org> wrote:

    Entering Hibernation mode on my speedy laptop used to take five
    seconds. Now it's taking 20. There have been several Windows updates
    so I suspect that may be the reason, but it got me wondering: is
    there a way to record what's going on during that interval? The
    screen goes blank as soon as I click.

    The more processes (programs, apps) you have running, the more memory
    that is occupied and has to be written to a file. More writes take more time. Also, the more processes that are running, the more that get a
    request to pause, and wait for them to pause, to have a stable memory
    image to copy to a file. Some processes are more responsive than
    others. Do you really need all those processes running again when you un-hibnerate?

    Have you performed any disk maintainance. You did not mention the type
    of storage media to where the hiberfil.sys file gets written. Could be
    HDD or SDD. For HDD, have you ran a 'chkdsk /r' to ensure all its
    sectors are in good condition? Have you defragged your HDD?

    Did you used to use hibernate before, or did you use hybrid sleep?
    Hybrid sleep does not fully shutdown the OS. The hyberfil.sys hibernate
    file gets written, but there is no shutdown process. Instead the
    computer goes into a low-power state. If there is no power outage, the computer remains in sleep mode ready to awaken very quickly (no need to
    read the hiberfil.sys file into memory). If there is a power loss, the hiberfile.sys file is available to restore the memory image. With
    hybrid sleep, there is no time spent waiting to suspend processes or to shutdown the OS.

    Did you add more system memory? The more there is, the more
    takes to write it to a file. The hiberfil.sys file size is about 40%
    the size of the system memory. There is some compression. On my system
    with 64 GB of system RAM, the hiberfil.sys is 26 GB in size. That is a
    huge file.

    <Aside> I don't ever hibernate my desktop PC, but shut it down if I
    won't be using it for awhile, like when away on vacation. Else, I
    leave it running 24x7. I don't even have it go into low-power mode,
    but some users want that (save a few pennies on lower power
    consumption, but it's trivial to me). If it were a mobile device
    instead of a desktop PC, and it used HDDs (spinners) instead of SSDs,
    yeah, I'd have it go into low-power mode to stop the HDDs from
    spinning. The gyro effect of spinning HDDs is why I use SSDs in
    mobile computers. I don't have to remember to sleep before moving the
    mobile computer. I really should disable hibernation, and delete that
    huge hiberfil.sys file. Also, for an SSD (I have a 2 TB NVMe SSD m.2
    memory card), 25GB is a hell of a lot of writes to stress the SSD

    Thanks! That's a lot to chew on. Windows 10 Professional is it
    - I'll take a look at the policy changes you suggest.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)