Using rtt for calculating execution time

Hi everybody, since I have been wondering how I could make a time metric for the execution of my code ,is it possible to use the timer that we see in the rtt terminal to our advantage by any chance to get the execution time of particular functions, for context i am using an stm32f407vgtx board with analog digital and can inputs, we need to get the time difference between how fast the function executes when the data is received.