From the rest of this site you'll probably realise that Linux is my preferred operating system. I'm paid to write software for Windows, however. When writing applications for Windows - especially those without any user interface as many of mine are - the Performance monitor application is quite useful. This can be found under Administrative Tools/Performance in the Control Panel.
Jeffrey Richter has a useful article on adding your own variables, but sadly there's a few drawbacks with his sample code. Since I spent ages trying to fix one of them, and couldn't find anything else on the web about it, I'll document that one here.