Windows 7 Sleep Debugging

So after I added the SSD to the HTPC and moved my hard disk into the  NAS drive, I began to notice the machine no longer automatically goes to sleep.    If I hit the power button (set to sleep) or run it from the command line (%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby) the machine goes to sleep just fine, but won’t do so automatically.

Mucking with powercfg (which is a very interesting program BTW.  Run powercfg /? if you’re not familiar with it) I found the following:

powercfg -requests

[DRIVER] \FileSystem\rdbss
A file has been opened across the network. File name: [\medianas\Photos\blah\blah\blah\IMG_9088.jpg] Process ID: [4456]
[DRIVER] \FileSystem\rdbss
A file has been opened across the network. File name: [\medianas\Photos\blah\blah\SANY0014.jpg] Process ID: [4456]
[DRIVER] \FileSystem\rdbss
A file has been opened across the network. File name: [\medianas\Photos\blah\blah\blah\IMG_9160.jpg] Process ID: [4456]
[DRIVER] \FileSystem\rdbss
A file has been opened across the network. File name: [\medianas\Photos\blah\blah\SANY0118.jpg] Process ID: [4456]
[DRIVER] \FileSystem\rdbss
A file has been opened across the network. File name: [\medianas\Photos\blah\blah\IMG_0053.jpg] Process ID: [4456]
[DRIVER] \FileSystem\rdbss
A file has been opened across the network. File name: [\medianas\Photos\blah\blah\PC060102.jpg] Process ID: [4456]

So basically, the Media Center Screen saver is actually preventing the system from going to sleep because it has all these photo files open across the network.    I really like the screen saver, and I don’t want to suck up space on the SSD with photos.   What to do?

It turns out, there’s a hidden setting in powercfg which will allow to enable sleep when files are open over the network.   I assume the option is hidden by default because most folks wouldn’t understand what “remote opens” were.     There’s a very helpful blog post here which explains a number of hidden power/sleep settings in gory detail.   Low and behold after importing the registry file (run regedit as administrator):

Hidden option in Windows Power Config

Still need to do a little more testing but I figure this should do the trick.   Just a couple more handy commands for my own reference:

Put the computer to sleep from the command line

%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby

What was the last reason the PC woke up from sleep

powercfg -lastwake

List all the requests from processes to prevent the computer from sleeping:

powercfg -requests

Analyze any power usage issues the system might have

powercfg -energy

See “powercfg /?” for more info.

Jumbo Frames, iSCSI and Disabling Nagle

So the new project (which I get to spend about 15 minutes a week on) has been to remove the mechanical harddisk from my HTPC and have it run completely silently off the SSD.   The first stage was purchasing the ReadyNAS NV+.  2TB drives have dropped below $100 so a NAS device with 1Gb networking was the no brainer solution.

Given I have two ATI CableCARD tuners (which BTW are no longer being made or supported by ATI), I needed to make sure the network and NAS had enough bandwidth and performance to write two simultaneous HD streams, while reading a third.  Now in theory, with a 1Gb network, you should be able to get roughly 100MB thoughput, unfortunately the real world doesn’t work that way.

My initial testing using Lan Speed Test (more on that later) showed I was getting around 24MBps writes and 45MBps reads.  (Remember big Bs are Bytes and little bs are bits.  8 bits to a byte)  So looking at my Comcast HD recordings, it turns out Fox is broadcasting 1920×1080 MPEG2 at around 14Mbps.   This isn’t that bad.  Note that DirectTV uses MPEG4 at around 5Mbps.  Since mp4 delivers better quality at lower bit rates,  the DirectTV advertisements aren’t lying when they say the picture is better.   For comparison, a typical DVD is MPEG2 @ 9.8Mbs and a BlueRay is MPEG4 at 40Mbps.   So if you haven’t figured it out yet, HD can really mean anything you want.

But the answer is if you want to record 2 HD TV channels from Comcast, you need about 2MBps per stream, or really just 4MBs, but you definitely want to have some head room, and there’s also the need to play DVD images back from the drive

I was hoping to get a little better than 25% of maximum throughput so started looking for solutions.    The first thing I poked at was the Nagle’s algorithm attributes.    This basically tells the TCP stack to gather all the small requests in to one big one before sending.     Turns out gamers want to disable this feature to make sure every keystroke/click is sent the moment they enter it, and not let things batch up on the network card.    For media streaming, you want the opposite behavior, but you’re rarely sending small data packets anyways.    But just for kicks, I set the following registry settings


GlobalMaxTcpWindowSize = 0x01400000 (DWORD)
TcpWindowSize = 0x01400000 (DWORD)
Tcp1323Opts = 3 (DWORD)
SackOpts = 1 (DWORD)
TcpAckFrequency = 4 (DWORD)
TcpDelAckTicks = 2 (DWORD)

And ran this command:

C:\ netsh interface tcp set global rss=disabled chimney=disabled autotuninglevel=disabled congestionprovider=none

Mostly from recommendations from this iSCSI site (more on that below):

Basically I’m saying the opposite.   Package up as many small bits as possible into larger ones to avoid the overhead.  Difficult to measure the differences here, but I’m recording them here for myself in case I run into problems.   Though, it turns out there is another TCP feature along the same lines that does help with streaming media and was much more noticeable.

I had already done all the cache optimizations possible on the ReadyNAS, and configured it for Raid 0 since I really don’t need redundancy for recorded TV shows and I’m using Amazon S3 for offsite backup as described here.   One of the features I found on the ReadyNAS was support for TCP Jumbo Frames.   So it turns out the standards the Internet still runs on today were defined over 30 years ago.   Given the reliability of Ethernet at the time, the designers decided that 1500 bytes was the largest amount of data to be communicated in each packet so if the receiver didn’t get the packet, the resend wouldn’t be so large.    In today’s home gigabit switched networks, collisions and data corruption are almost unheard of.  So rather than waste all the CPU & interrupt time splitting and joining small packets, you just build one big one.   This is also a bit more efficient because each packet also requires header and footer  information describing where it should be delivered to.   Unfortunately, because everyone has to follow a standard, the largest the Jumbo Frame packet goes to is 9K, but that’s still almost a 4x increase in the data delivered with the same header and footer used for the original frame size.

So I started looking at the configuration for the on-board network adapter on my Intel P35.  No Jumbo Frame option, but this I found this note:

Note: The Intel PRO/1000 PL Network Connection supports jumbo frames in Microsoft* Windows* operating systems only when Intel® PROSet for Windows Device Manager is installed.

Cool!  So Installed Intel ProWin and still couldn’t find the JF option.   Do a little more research and find this:

The following gigabit LAN components included with Intel® Desktop Boards do not support jumbo frames:

  • Intel® 82566DM Gigabit Ethernet Controller
  • Intel® 82566DC Gigabit Ethernet Controller

Eeeekk! My motherboard chipset doesn’t support jumbo frames!    So it was off to Amazon to see how much a 1Gb PCIe Network card with JF support would set me back.    Since 1GB is not longer the bleeding edge (they now have 10Gb NIC over Cat6),  this Startect card was just under $25.    This also allowed me to do some real world performance testing between the two use Lan Speed Test:


Intel 82566DC

StarTech ST1000SPEX

SMB Read MB/s



SMB Write MB/s



So I’m pleased with the 30% speed improvement on write.   I read somewhere that JFs aren’t used for reads, hence there wasn’t any significant difference there.    So I’m all set right?   Oops, wait a minute.   It turns out that Windows Media Center won’t record to a network drive.    This is part of the DRM associated with CableCARD, which I’ve ranted about before.   It turns out the new ATI BIOS relaxed OCUR standards addressed most my CableCARD concerns.  This left two possible solutions:

  1. Record to the SSD and use DVRMSToolbox to move the recordings to the NAS (after commercial detection)
  2. Use iSCSI rather than SMB (Microsoft File Sharing)

Once again, going back to 30 years, there were a couple competing standards for attaching disk drives to computers.    Once of these was called SCSI and was championed by Apple and Sun (as well as many others).    SCSI had a bit high level command structure and some interesting chaining features that are similar to today’s USB features.   PCs meanwhile were using IDE interfaces which have evolved in their own direction.    Fast forward 30 years, and have these network cables which are now as fast as those big thick SCSI cables, so why not send the SCSI protocol over that?   Now you have iSCSI.

So the cool part is, you use iSCSI, and Windows thinks the drive is a local SCSI drive, not a remote NAS drive.     Of course, since I bought the cheaper ReadyNAS NV+ rather than the latest and greatest ReadyNAS Ultra, iSCSI support was not yet built in.   Enter the OpenSource world to the rescue.    Since the ReadyNAS NV+ is basically a little Sparc machine running Linux, Stephan at ported the Linux iSCSI Target daemon.    If you go this route, be sure to check out his support page which was a little tricky to find.    In short, the original directions pointed you to the wrong config file, as I explain here:

Downloaded and installed After following the instructions verbatim, I realized my target was not being created and spent a lot of time searching the net for the cause of this message:
iscsi_trgt: iscsi_target_create(131) The length of the target name is zero

I finally came back here and read all the comments. The problem the whole time was ietd.conf needs to be /etc/ietd, not /etc like the instructions say. 🙁

Hopefully google will find this comment for the next guy who comes along.

I mention a couple other quirks on the support page, but the above is the only one that matters.   So back to performance testing via Lan Speed Test:




Read MB/s



Write MB/s



Whoa, check that out!    More than 6x improvement in write performance!    In fact, it now writes almost twice as fast as the theoretical network maximum… umm… wait-a-second….   That’s probably not right…

A little more investigation showed that because Windows considers it a SCSI drive, there’s lots of local caching going on which was fooling Lan Speed Test.    Using Blackmagic’s Disk Speed Test (which also won’t work on a network drive), write speeds were around 14MB/s.    So the freeware implementation of iSCSI leaves a bit to be desired performance wise.    There may be some other things you could do via direct device access and later versions of iSCSI, but I decided to go back to the DVRMSToolbox solution.

So I’m actually pretty happy with the current solution where I record to a temporary directory on the SSD and then move the file over to the NAS.   This also allows the Dragon Global Showanalyzer to work on the files locally rather than scanning them over the network.


Intel 82566DC

StarTech ST1000SPEX

SMB Read MB/s



SMBWrite MB/s



Intel CPU Info tool.

Cool geekware to tell you about your CPU: Be sure to disable the evil Ask toolbar window from the install wizard.

Open Apple Pages .pages files in Windows

Quick fix for Grammie.   Someone had sent her some .pages files and she couldn’t open them on Windows 7.    Turns out that they are a Winzip compatible file archive with a PDF preview in them.      Since she doesn’t even have Winzip installed, I simply exported, edit, and imported the .zip registry entry so the Windows File Explorer would do the trick.       It ended up looking like this:

Windows Registry Editor Version 5.00
"Content Type"="application/x-zip-compressed"

I’m not sure if all those GUID and Shell data values are universal, but if importing the above doesn’t work, I’m sure you can figure out the same export/edit trick I did.  Note you need to logout and login again to restart the base explorer shell.   Enjoy.

Allway Sync now supports Amazon S3

So I’ve been using AllWay Sync tool for a couple  years now to keep laptops synchronized (free for home use).   I recently downloaded the latest version to help me back up the HTPC harddisk before pulling it out and moving it to the ReadyNAS NV+ as an iSCSI device (a story for another time).    In the back of my mind, I’ve also been contemplating various offsite backup strategies.    My photo and home video collection is nearing 1TB, and after seeing the San Mateo gas fire, I’m a little more motivated to get those offsite.

It turns out the latest version of AllWay now supports Amazon S3!  This basically gives you an unlimited storage solution for $1.20$1.11/GB/yr using S3 RRS.    Or $10 $9 a month for a TB of backup.   The beauty is you only pay for what you use, so 250GB is only $2.50 $2.25 a month, or $27/yr.  The AllWay tool can do scheduled synchronizations and after the initial sync, it only pushes new files and deletions.

Now the Internet backup providers like Carbonite are running right as low as $55/yr for unlimited backup, so you may be able to pay a little less for a more feature rich solution if you are over .5TB but if you have multiple PC’s (or a NAS).   That said $55/yr only gets you 1 PC and I don’t know if it will backup network shares.  Furthermore they don’t recommend the $55 solution for anyone with more than 200GB.  In fact, in their FAQ they mention something about bandwidth throttling at 35 and 200 gig.

Finally, Amazon has been consistently dropping the price on S3 storage every year, so it will only get cheaper.    Allway includes integration with Windows Task Manager, so scheduled backups are a breeze.   As soon as I get all the drives reorganized, this is definitely the next task on the list.

More CPU Envy

So just completed the configuration of my new Dell M4500.

  • Intel i7 Q72o @ 1.60GHz (not the fastest i7, but uses the least power)
  • 8GB memory
  • 60GB SSD drive
  • 500GB HD
  • Windows 7 Ultimate, 64 bit

The machine measures twice as fast as my old 4300 and the i7 excels at running VMWare machines. (Task Manager shows 8 CPUs: 4 hyperthreaded cores)  Add the SSD for the OS, and you’re not waiting for anything.   Furthermore, with a 64bit OS,  I now have 4G allocated to each 32 bit VM and they run like they are native.    Other nice touches are the back lit keyboard, wireless-N card and external SATA port.

My only complaint is the camera built into the screen is always pointed at you. I’d prefer it had a some sort of physical lens cap.

Nice big keyboard with three mouse buttons above and below the pad.

The WEI score is 6.5 due to I didn’t bother with the high end graphics card. Processor and SSD come in at 7.0 and 7.3. 7.9 is the highest score possible, don’t ask me why…

Mean looking charcoal black case

BTW: The upgrade to the latest BIOS from Dell seemed to solve the BSOD problem I saw a couple times.    Haven’t seen it since.

CPU Envy

When I first started working for SCO in 1989, Xenix was the ONLY 32 bit operating system available for the Intel 386 platform.   In fact, in 1983, when Linus Torvals was 14 years old, SCO had Xenix running on two platforms:  the Mac Lisa and the Intel 8086.   Yes,  years before Tanenbaum’s Minux was released, SCO had a AT&T System III kernel running in 640k of memory.   And Microsoft even paid them to do it!  But for that story, see wikipedia.

So when I arrived at SCO, their primary focus was still writing OS software and I was working on the X Windows port to the new SCO Unix, the successor to Xenix.  I started with a Zenith 16MHz 386 on my desk, and at the time, that was considered a lot of CPU to dedicate to one user!  But the best part of the job was being one of the first people to work on the 486 in order to get the X server running on the platform.   Of course, I didn’t get it on my desk, I had to drive over the hill to Olivetti for a few weeks (where people smoked in their cubicles!) and work on the machine there because there were so few of them.   Later on, I had the same task on one of the first Pentium systems in order to demo an X Windows application running faster than the Sun Workstations of the time.

Those were the days when it was simple to tell which was the faster Intel Processor.   You just looked at the name: Pentium, Pentium II, Pentium III, and the MHz number and it was obvious.  With the Pentium 4 we were up to 10K MIPS.   And then Intel decided it was better to confuse the market.   So now let me ask a simple question:  Rank the following Intel processors in order of performance:

Intel Core i7 820QM @ 1.73GHz

Intel Core2 Quad @ 2.83GHz

Intel Xeon X5670 @ 2.93GHz

Well you have to figure this is easy,  the Xeon line was introduced in 2001, the Core 2 in 2006 and the core I7 in 2010!   So even given the lower GHz number, the i7 must be the fastest of the bunch, right?    Turns out to be just the opposite.   The i7 is the slowest processor listed, and the Xeon is the fasted, with the Core 2 winding up in the middle.     Of course, the Xeon platform has been redesigned a few times since 2001, and if you look at this handy chart from PassMark, you’ll see that an Intel Core i7 X 980 @ 3.33GHz does now top the list as Intel’s fastest processor, but the models vary widely below that depending on everything from cache size, to bus speed. (And they haven’t listed the Xeon x7350)   It’s been fairly widely recognized now that increasing clock speed no longer gets you the performance returns it once did.

But how does this help you decide which Intel CPU to buy?  Well there’s one more piece of information you need, and that obviously is price.   In this case, the folks at pricewatch are nice enough to give us the latest CPU prices for both Intel and AMD (ignore the PassMark price, it’s already out-of-date).   So now you can see how much each of these cost.   But the thing you really want is a mash-up page (sorry, someone with more time than I needs to build it) that shows you the PassMark/$ figure.    Going back to the three I listed:

Intel Core i7 820QM @ 1.73GHz 3500/$250 -> 14PM/$

Intel Core2 Quad Q9300 @ 2.50GHz 3500/$149.00 -> 23PM/$

Intel Xeon X5670 @ 2.93GHz 9600/$1359 -> 7PM/$

So it’s interesting that with the cheaper processors, you actually get more bang for the buck than the ultra high end.   Another thing that adds to the cost is the power draw.   So I’ve been eyeballing the Q9550S, which is the low power version of the Q9550.  The lower power also means less heat, which means less fan noise, which is always a big win in a HTPC to replace my poor Intel Core2 Duo E8500 @ 3.16GHz.

The E8500 only rates 2400 on the PassMark test, while the Q9550 is at 4300.  But once again we find at $148, the E8500 is getting 16PM/$ while the Q9550S at $350 is only 12.   Now do I really need 2 more processor cores to rip all the old Disney video tapes to disk?   Probably not, but it’s not like you need 4WD on that SUV, but you sure like having it…

Simple document scanner program

Ever needed to scan a document using a manual scanner?   I used to go through this painful process using the scanner wizard and pasting the images into a word document.    With a quick search, I found Documalis Free Scanner It’s written by a French company, so depending upon your language skills, you may have to click over to the English UI when you start it up.    From there it’s one button push for each page, with thumbnails showing you the pages you’ve already scanned, and the ability to save the whole thing as a PDF.   Couldn’t be easier and you can’t beat the price.

Two minor oddities:

  1. The first scan starts immediately.   You need to be ready to go when you start the program
  2. You have to pre-select your destination directory.    The filename dialog at the end isn’t the standard Windows browse and save.

Once again.  It’s a great program for the price.

Every SSD could use a little TRIM

So I was an early adopter of a Corsair P128 SSD drive for my media center machine.   I was extremely pleased with the fact that it eliminated 95% of the disk noise, even though I left the 1TB HD in the machine.   Even when recording to the HD, it barely makes a noise since the OS is completely running off the SSD and the HD doesn’t need to do any seeks.   But because I bought the disk right around the time Windows 7 was release, the SSD firmware didn’t yet support the TRIM command.

What the TRIM command does is tell the SSD to actually clear all the data from deleted files.    Regular old harddisks don’t care much whether they are writing to an empty space, or overwriting a deleted file.   Hence, when you delete a file, usually all the operating system does is mark the space used by the file as free.   Then the next file is welcome to overwrite that space.

Unfortunately, due to the design of SSD memory, it’s actually much slower to overwrite existing memory, because it needs to be cleared first.   This becomes even more time consuming when you are writing a file that is smaller than the SSD block size (Both traditional and solid state drives like to deal with data in a standard size like 256KB or 512KB.  This is called a “block”).   In the case of the SSD, it needs to read the entire block into memory, clear the entire block, then write it back with your small change.    Now this is all done internally on the drive, but still is much slower than a simple read or write.

If the OS knows it’s dealing with an SSD, it can send along a TRIM command after every delete operation.    This tells the SSD to clear the memory associated with the files that were recently deleted.   Note this can usually be done in parallel to other work, so by the time you want to write something to that same block, the freed data has already been cleared!   Note, this does disable the ability to retrieve deleted files, which has long been a double-edged sword in the DOS/Windows world.

Anyways, I thought I was running on a TRIM-less SSD, which meant my performance was going to suffer over time.   Luckily,  at the end of last year Cosair released a firmware update for the both the P and X series which adds the TRIM command.  It just took me a while to remember to check for it.  I was able to verify the SSD firmware version using a clever tool called Crystal Disk Info.   Unfortunately, I only have the “after” screen shot.   In the before shot, the work TRIM was faded/stippled, like the APM in this one.

That’s the good news, the bad news is that the firmware upgrade ERASES THE ENTIRE DISK!   That meant I need to explore Windows 7 backup and restore options a little more.

I was pleasantly surprised.   Backing up an image SSD to the HD was just a few clicks using the windows backup tool (OK, I did have to delete a number of old episodes of Ace of Cakes and Project Runway to make space [ sorry honey ] ).   The one hiccup I had was creating a bootable recovery CD.    After telling you to insert your CD, the create recovery disk program would hang and eventually error out with an Optical Drive error.   The problem turned out to be an old version of Virtual Clone Drive which was giving the system fits when trying to identify the disk devices.  Removing it solved the problem, and I wasn’t able to repro it after installing the latest from Slysoft.

The most challenging part was that firmware upgrade documentation insisted that the installation program was only supported when running from a bootable USB flash drive.   This turned out to require a bit more research than I expected.    I found a number of links with a number of different methods for creating a bootable flash drive.   The simplest one I actually found on a German website I translated through Google.   But after a quick search today, I found the same instructions on a native english site as well. The bottom line is you grab the HP Flash Format program and a copy of the DOS system files.     The HP program is fairly idiot proof, and will allow you to browse for the DOS system files you want to load.

After copying the P128 firmware files to the USB drive (after formatting it with the bootable OS) it was amazing how quick and painless it went.    I did have to muck with the PC Bios to tell it to boot off the flash drive, but once I did, every thing went quick and easy. I actually wasn’t sure it had worked, but running it the second time it said there was nothing to do.   I then booted off my Windows recovery disk, and it automagically found my backup on the HD, and asked me if I wanted to restore the SSD.   It really couldn’t of been any easier.

Now, if I could just get the latest version of Arcsoft TMT to play BDs on my system.. but that’s a story for another time.   For now, learn from my trials and tribulations and DO NOT try to use your HTPC as your primary BD player.   It will cost you at least $400, and you can buy the same thing for $99 at Best Buy.   As you can guess, there’s a 1000 word rant waiting to be released about this one.

Fun with the iPad

So I decided to get my wife an iPad for mothers day that MPSharp needed to do some iPad research (business requirement), so I picked one up at Best Buy a few weeks ago.   Went for the 64G version with no 3G, thinking that I really didn’t need to give AT&T more money on a monthly basis.  Also, given the iPhone 3G is getting a little long in the tooth, I figured it was time to jailbreak it and turn it into a mobile hotspot for your mobile.   I’d already added mobile hotspot software to my HTC Touch Pro 2 (Tilt 2) and the iPad works great with that.   The question was how much work was involved to jailbreak the iPhone.

So it seems it seems that jailbroken iPhones are now widespread enough to have their own app stores.    Jailbreaking the phone is now idiot proof.   Download the Spirit  jailbreak program, connect your phone, run the program, click “Go” and you’re done!   Installing the hotspot software was a little trickier.   I actually paid $9.99 for MyWi, which also required another jb app store manager called RockYourPhone.  Of course, as soon as I paid for that, I found a free one called PDANet.  This got me wondering about the market for jb iPhones and how many of them there are.   Last year, Cydia reported almost 500,000 visitors a day (I’m sure they are well past that now)  It’s an interesting testament to Apple’s business model.

So back to the iPad.   A few observations:

  1. It’s heavy. It’s too heavy to suspend in the air for any length of time.   Even trying to watch a 5 minute YouTube video is a little too much.   I suspect stands will be a hot selling item, especially if you want to watch a movie on an airplane, or some such.
  2. Lack of Flash sucks.   I sincerely hope Apple loses this fight.  I did find an interesting Bookmark hack called iTransmogrify which pipes the video through YouTube to make it iPhone friendly.   This helps to a small degree.   As usual, there are some JB solutions such as iMobileCinema, but I’m not excited about jailbreaking the iPad just yet.
  3. The screen is difficult to read in outside daylight.

Now don’t get me wrong, it’s still a very compelling device.   Browsing through the JB iPhone is useable, but it seems to go much faster through the HTC which has been hacked for HSDPA (4G) performance.  It really seems to get the most use as a TV companion device.   It currently shares the coffee table with a laptop, and it’s interesting to see which device you want to use for what.   For instance, I’m using the laptop to write the blog (the on-screen keyboard is much better than the phone), but nothing really beats the lean back browsing experience.   It’s obvious the device will have an infinite use as a remote control, even if it’s made obsolete by newer versions.   I just installed an RDP client on it today and used it to play music on the HTPC.   I happen to know there are a number of  interesting IR solutions out there made for the iPhone, they’ll be even more usable with the iPad, but even an old iPod Touch will work in this case.  I’ll wait for the price on those to drop a bit.  Next thing to try is some book reading, but I still think the device is going to be to heavy to do that comfortably.

Finally, it wins hands down for one handed browsing while feeding a baby.