I have a friendly competition with couple of guys in the field of programming and recently we have become so interested in writing efficient code. Our challenge was to try t
There are pieces of software called profilers which exactly do what you want.
An example for Windows is AMD code analyser and gprof for POSIX.