Frej Drejhammar wrote:
You can
profile sections of code yourself by reading the 8253 timer
both before and after a block executes, then subtracting. Mail me if
you'd like some example code. The timer counts from 65535 down to 0
about 18.2 times every second; if the code you're profiling executes
in less than 55ms, then you can do your own microsecond-accurate
timing.
A good reference on how to do this is in Michael Abrash's Graphics
Programming Black Book, Chapter three[1]. BTW, the whole book is great
reading if you are interested in x86 optimization in the [345]86-era.
Regards,
--Frej
[1]
http://www.gamedev.net/reference/articles/article1698.asp
I read the introductory chapters where he introduces his timing
technique. Jim Leonard also offered to send me a similar set of code,
which I am going to take him up on. But like Chuck pointed out, I'm
actually more interested in seeing where my time is being spent across
the entire application, not in just measuring a particular function.
The other idea that is starting to appeal to me more is to start adding
counters to my code. For example, if I add one counter to tell me how
many times I polled for new packets and I add another counter that tells
me how many times I actually found a new packet, then I have a rough
idea if I have a flow control problem or a CPU problem.
It's fascinating what we take for granted in a modern OS ...
Mike