i am trying to find out a way in which i can write out run-time of selected number of functions when my tool runs. let say out of large list of functions which my tool have i need to write out the what is the time taken by individual calls y(), z() , a1() ….
X(){
y();
..
..
z();
..
..
a1();
..
..
b1();
..
..
}
I don’t want to use gprof because it need to be separately run , and there is no way customer can run gprof at there end. In many cases i don’t have access to the test which is producing long runtime. A way to log run time of high level function will be helpful. i dont’t want to wrap around each and every function call around time() system call and then print it. Can macro help in this.? any ideas?
You said you don’t want to wrap each call, but let me just show you how I handle timer calls so they can be removed at compile time, and maybe that can be wrapped up in another macro later:
Now you can use it like this:
With variadic macros you might even be able to wrap up the function call: