Having source like this:
void foo() {
func1();
if(qqq) {
func2();
};
func3();
func4();
for(...) {
func5();
}
}
I want to obtain info like this:
void foo() {
5 ms; 2 times; func1();
0 ms; 2 times; if(qqq) {
0 ms; 0 times; func2();
0 ms; 2 times; };
20 ms; 2 times; func3();
5 s ; 2 times; func4();
0 ms; 60 times; for(...) {
30 ms; 60 times; func5();
0 ms; 60 times; }
}
I.e. information about how long in average it took to execute this line (real clock time, including waiting in syscalls) and how many times is it executed.
What tools should I use?
I expect the tool to instrument each function to measure it's running time, which is used by instrumentation inside calling function that writes log file (or counts in memory and then dumps).