Calculating time spent by a function in Microcontroller Applications
The most basic maneuver for complicated functions is to utilize the onboard timers.

Depending on how you set them up, you can get them to count exactly the number of clock cycles it takes for a certain function to execute.  Simply read the timer before the function call and then again after the function call.  

You will have to look through the assembly code to know how much time to take off the timer for the read calls but if it is a lengthy function or if you don't mind being by a couple of clock cycles then it is ok. 

The only error in the conversion from clock cycles back to time is the possible error in the system clock's oscillating frequency. Again, this will be negligible for functions which take significant time to execute.

It sounds like in your case you want something around 30Hz (30 FPS) which is a very long time compared time cycle of the processor clock.