That depends on your OS and compiler.
With Linux / GCC for example, there is an additional utility call 'gprof', which does what you're trying to do automatically for every function (no need for you to edit code).
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
> I think gprof has issues with multithreading.
You know this for a fact, or is it just "heresay" rumor from long ago.
Even if it is true, you can still get some useful information by arranging a single-threaded test.
> But will timing functions yield correct result ?
By it's nature, timing is a slightly intrusive activity, which you have to be mindful of at times.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953