Saturday 24 January 2009

Where's all my battery gone? / Windows 7 Hardware Interupts

So I got the Windows 7 Beta as soon as it came out and installed it on my laptop to give it proper "real world" testing, not a VM or a machine I use rarely. I chose to do this as it means I can give Microsoft proper feedback and if it all goes wrong I can simply reinstall Vista clean and restore data from the previous night


I have to say I really like windows 7, the UI changes do work for me, I like some of the new features and on the whole I'm happy with it. But this post isn't going to be about my last two weeks of running Windows 7, I'm already writing that post and need to finish it when I'm happy I've gave a real world usage. This post is about how since I've installed Windows 7 my battery life sucks.


Now this isn't a rant, instead I want to highlight how I found out that something was wrong with my install.


So when I started using Windows 7 I noticed that my system kept slowing down, I soon fired up Task Manager and found that AVG antivirus, I use the free edition for Home Users, was eating a large chunk of my CPU, it seems it was always running around 30% if not more. I checked the Windows 7 Blog and found they had a list of compatible anti virus solutions, AVG was one however it didnt indicate if the free version was so I decided to remove AVG and try the Kapersky beta instead.


After doing this the system did feel more responsive so I was happy with this and thought this was then end of it. However this week, in particular the last 3 days I noticed that my battery was running out in 60 mins or less, normally I get at least 1.5 hours, 2 if in "power saver" mode. Initially I pondered if the power profiles were running properly, I checked these and all seemed fine, "balanced" mode whilst running on battery would set the minimum cpu usage to 5%, all seemed well.


This morning I decided to look into this battery issue further, I started Task Manager and nothing seemed to be using the CPU but when I looked at the performance task I saw something very peculiar, see the image to the right, Core 0 was running at all times at 90%! This must be the cause of the battery being depleted so quickly, if the core is always active the power saving features can't kick in, thus burning good old power cells.


Unfortunately task manager wasn't showing what was using the CPU, not even showing processes from all users helped. So I went and got the only application you need to investigate memory leaks or CPU usage, process explorer. Upon firing this up I saw straight away the culprit, Interupts which is part of the System Idle Process and handles all Hardware Interupts was constantly eating ~40% CPU!


Now here's the problem, this is a system process, which has no threads, it's core, there's no easy way (that I'm aware of), to find what is causing the Interupts to constantly burn CPU, I looked at shutting everything down that could be causing the issue, my thoughts were the animated Synaptics TrackPad icon, as this responds to your input, the On Screen Display program that indicates when you turn Caps Lock on/off etc, but still nothing changed.


This sadly looks like a Windows 7 issue and one that may force me to reinstall my laptop back to Vista, has anyone else found had this issue or know what causes it? If so leave a comment, in the mean time I'm going to report the issue to the Windows 7 guys and I'll update this post if I hear anything back.


Update:

Well it looks like this is now solved, Intel have released a new Chipset Driver : Intel Corporation driver update for Mobile Intel(R) 965 Express Chipset Family (Prerelease WDDM 1.1 Driver), this is an optional update for Windows 7, hence how I managed to miss it the first time I checked, so there it is if you find Hardware Interupts are cooking your CPU check for an updated Chipset driver, helped me out anyway.

Further Update - 27/01/2009

Much to my dismay this issue is still present, the driver update seemed to make things better however if my laptop goes to sleep and then I resume the issue reoccurs, hopefully Intel may release an updated driver to fix this issue....

Wednesday 21 January 2009

Visual Studio Welcome Screen

Today a colleague noticed that whilst he was debugging his web application random requests were being made to Microsoft, these requests were also returning a HTTP/1.1 301 Moved Permanently header, and apart from being annoying was causing him a few issues.


From experience I soon realised that these requests were being made by the Visual Studio Welcome Screen. By default even if you don't use the welcome screen, Visual Studio keeps the Start Page News Channel RSS Feed up to date, the default in every 60 minutes. If you aren't using the welcome screen then its probably worth disabling the RSS feeds auto download content functionality, not only will this stop you seeing random requests, if you even notice them, but if you are working on a mobile and pay per KB save you some bandwidth.


To disable the auto content update simply: goto Tools > Options, click the Show All Settings checkbox, then under the Environment leaf find Startup. Once here simply untick the "download content every" check box. You can also configure it to update less frequently, alter the news channel location, for example you may prefer to use the DotNetShoutOut RSS Feed.

Monday 19 January 2009

Syntax Highlighting and Intellisense for WSC Files in Visual Studio 2008

Recently I've been working on a system that makes use of custom WSC components. These components contain the usual XML Wrappings and then a large CDATA area containing the VBScript code.


What's really been bugging me is that Visual Studio was treating all the code within the CData XML Area as XML and I really want the VBScript to be all nice and highlighted and for VBScript intellisense to kick in, it really does save time. Now luckily making this happen was remarkably easy.


First within Visual Studio go to tools and options, click Show All Settings. Then open the Text Editor leaf and click on File Extension. Next add a new option for wsc files and specify that you wish it to use the Web Form Editor as it's editor. Click Add and then OK. You should now find when you next open a wsc file the XML has syntax highlighting as well as the VBScript, and intellisense works!


I hope this helps you, it certainly did me!