On Agner Fog's site there's a program he wrote to measure the number of clock cycles a piece of code takes. But for obvious reasons you can only use it in real dos mode. Would it be possible to create such a program for windows, gaining the full processor time for a while? Of course it's against the windows rules but would it be possible? That would be a lot easier than switching to DOS mode all the time (especially with winME (no DOS boot option) and win2k (has never had a dos boot option):(). Thomas
You could write a VXD (or in case of NT, "something else") to do the exact profiling. Or you could get intel's VTUNE (pretty expensive, as far as I have heard, but there's a demo version I think). OR, you could realize that in a real-world situation, your application will be battling other applications for CPU time (and other system resources), so you get a more accurate profiling view by running your application "normally". (My excuse for being lazy ;) )
Windows actualy does allow you to do that using the functions 'SetPriotyClass', and 'SetThreadPrioty'. A much shorter alternitive under Win9x is to use a CLI instruction. This disables interupts preventing windows from gaining control of the CPU completly. You can re-enable interupts with the STI instruction.