Hi,
to measure the execution time for a function: (works in either way, with every complier)
* SET a port pin before you start the function
* CLEAR a port pin after leaving the function.
Use a scope to measure the "high" time of the port pin.
I´m not familiar with C, so I can´t help with flash and SRAM.
But sometimes it is usefull to know the max. stack size:
* Either initialize the memory area of the stack with a known value and check how many values are altered during after execution.
* or run (random) timer interrupts, that simply read stack pointer vlaue and stor the max. value. Mind that the timer interrupt usually needs extra stack values.
Hope this helps - at least a bit.
Klaus