Callgrind

Callgrind is a profiling tool of the Valgrind set of tools. The most basic usage would be to see when, how often and how long a function is called to see where you could improve your execution time.

Stanford University has a nice introduction to Callgrind: https://web.stanford.edu/class/archive/cs/cs107/cs107.1222/resources/callgrind

For the visualization with KCachegrind take a look at the KDE KCachegrind Handbook and the following article (the part after “The real way”).