Being a judiciously paranoid android, this meant I had to stay up until six in the morning troubleshooting, eyes half-open, tweaking and testing to discover what was using my idle cycles so aggressively.
Finding the CPU Hog
The difficult part of finding the culprit was twofold: the offending process only seemed to run when the computer was idle (which takes about five minutes for Windows to decide is the case), and touching the keyboard or mouse (such as to sort processes by CPU % utilization) caused my quarry to go back into hiding.Naturally, Mark Russinovich had me covered. Process Explorer has a CPU History column that can be added to the processes pane, and if you sort processes by either CPU or CPU History, you can see the offending process without manipulating or interrupting the idle state of the desktop.
So, I set it up and hopped back into bed, waiting for the fan to come back on. And of course, it did. After one failed attempt (I screwed up and hit a key before my eyes were really open), I was able to hop back out of bed and find that MsMpEng.exe had risen to the top of the list. I have a list of executables on my box which I searched for MsMpEng, finding one of the paths within an amd64_windows-defender-service WinSxS directory. The Windows Defender event logs (in eventvwr.msc) correlated with the times at which I had been woken up, confirming that this was probably the culprit:
A little bit of searching confirmed that other people have had this problem due to scheduled scanning, which encouraged me to look in the Task Scheduler MMC snap-in and find this:
Being tired, I disabled these, made a note of it in my TODO list to look into later, and hopped into bed.
Cue Fans
Then it started *$#@ing doing it again!I hopped out of bed and looked at Process Explorer, which I had left around out of either cynicism or laziness. The new hotness was svchost.exe -k defragsvc. DISK DEFRAGMENTER! I thought you died with Windows 95! I picked through the services MMC snap-in (services.msc), eyes still half-open, and couldn't find it. I went to the command-line to figure out WTH the service name was so I could disable it.
C:\Users\someone>sc qc defragsvc [SC] QueryServiceConfig SUCCESS SERVICE_NAME: defragsvc TYPE : 10 WIN32_OWN_PROCESS START_TYPE : 3 DEMAND_START ERROR_CONTROL : 1 NORMAL BINARY_PATH_NAME : C:\Windows\system32\svchost.exe -k defragsvc LOAD_ORDER_GROUP : TAG : 0 DISPLAY_NAME : Optimize drives DEPENDENCIES : RPCSS SERVICE_START_NAME : localSystem C:\Users\someone>
Yes, I could have disabled it from the command-line if I'd had the patience. Instead I went and changed the service start-up type from manual to disabled. I went to bed and laid with one eye open... The screen dimmed, as it had before. Then it went black, and still nothing. Success!
A Workaround
This morning I re-enabled the services, and this evening I wrote a test to evaluate a fix for my sleep timer that would suppress idle tasks when it is in use (allowing me to sleep).sh = new ActiveXObject("WScript.Shell"); function nudgeDown() { sh.SendKeys(String.fromCharCode(0xae)); } while (true) { nudgeDown(); WScript.Echo('Sleeping 60 seconds'); WScript.Sleep(60 * 1000); }
I saw that sending the volume-down character every 60 seconds stopped the screen from dimming, and I'm optimistic that it will serve my purpose. In the long-term, maybe I could throttle Windows' CPU frequency scaling governer, but for purposes of going to sleep tonight, this will do.
Another time, maybe I'll describe how that snooze timer works. For now, I'm snoozing. G'nite.
No comments:
Post a Comment