0

I have a function which in turn calls many functions. e.g.

void fun()
{
f1();
f2();
f3();
....
....
f50();
}

I want to calculate execution time of f1, f2....f50. Now if I calculate the time before and after execution of each function and then find the difference, I have to write it for all of these 50 functions which I want to avoid as it looks bad. Is there any simpler way to do this ?

1
  • 1
    Have you tried to use a profiler? Commented Jan 6, 2017 at 7:43

1 Answer 1

1

Use a wrapper function which gets the actual function to call as an argument, and have the timing code only in that wrapper function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.