I did some digging to figure out if one can setup cold-startup testing in Windows 7 without nasty hacks. My conclusion is: sorta-kinda.
The Good - Most of the Ingredients Are Present
I haven’t actively used Windows since pre-XP days. It looks like it has come a long way since then: there is now a decent interactive shell, all kinds of settings/services can be controlled from the commandline and there is even sudo-like functionality.
PowerShell takes inspiration from the korn shell and throws in .net which allows for much nicer “shell programming” than the dominant bash shell.
mountvol is a terrible equivalent to mount in linux - but it exists, so I’m happy.
NTFS junctions are frustrating equivalents to links in a unix filesystem.
The Bad
The essential ability to completely flush filesystem caches isn’t there. This isn’t quite as embarrassing as it seems as Mac OS X’s purge command does not flush the page cache (resulting in mmapped files not purged from cache), so technically OS X has the same limitation and only Linux gets it right.
The Ugly Workaround
After much brainstorming we figured out that we can clear all relevant caches on Mac OS X by putting files that we care about on a separate partition and mounting/unmounting it for every measurement.
Ridiculously, Windows is “smarter” than that and appears to cache stuff per-drive, such that mounting/unmounting a partition has no effect on the cache. The best workaround I could come up with involves putting the said partition onto a USB disk and unplugging it in-between unmount/mount testing cycle.
Windows 7 Startup Recipe
1) Set up junctions for the 2 profile directories to point to the USB partition, unzip firefox onto that partition.
2)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
3) Unplug USB drive