How can I find the time taken while a function is being called? I tried using millis, but I wanted to know if there is any better way to find out the exact time from when a function is called and finally when it terminates.
There is micros() which returns the number of microseconds the board has been active. But it rolls over much more frequently (a bit over an hour vs the month and a half for millis())

unsigned long preFunction = micros();
foo();
unsigned long timeElapsed = micros() - preFunction;