You can use this method for either the main loop, a function of any two points in the program sketch
The least intrusive way is to set a port pin high before the function call and low afterwards. Put an oscilloscope on the port pin and measure the high-time.
This can also give you a good qualitative idea of the variability of execution time by triggering on the rising edge and watching the jitter on the falling edge.
C-3PO
I think it's the way I have learnt most of my stuff - getting very stuck first...