How to use perf (or any other tool) to find out the execution time of an application function

Viewed 581

I have a threaded application and I want to know the execution time of the thread function that is in a loop.

Assume:

void thread_func() {
    while(1){
       func1();
       func2();
    }
}

I want to see how long it is taking the loop to execute and the time needed for func1 and func2 on a running system. Its a production system and I cannot modify the binary. Can perf or any other tool help me profile the timing here ?

0 Answers
Related