I need some help in terms of profiling existing code in terms of execution time. The intention is to speed it up.
I've been given some code that was worked on previously. It is completely written in C++ with OO concepts. There is a GUI based interface to it, and selecting a certain option runs selected peiece of code. (There are about 11 classes as part of the project).
I want to be able to press a GUI option and let the code run and generate a resource map like:
Functions of Class 1 = 20% of execution time
Functions of Class 2 = 60% of execution time
Functions of Class 3 = 10% of execution time
Functions of Class 4 = 10% of execution time
That way, I know which class is taking up the most time and then know which to work on and improve. However, I have no idea how to go about doing this. I only have basic C++ knowledge.
I did read this post: find c++ execution time, however since the program is not serial. One class calls another, and that calls another, I don't know how system clock/ticks would be implementable?
I read of program like Valgrind, Zoom, Poor Man's Profiler etc. but honestly have no idea on integrating it with the code. Is there so simpler method?
I also read this method: How can I profile C++ code running in Linux?, however I don't see how I could get pin-pointed information as to class based information (Class 1, Class 2 etc.)
Could someone please advise for a newbie?