[Lazarus] Profiling with Valgrind and KCacheGrind

Juha Manninen juha.manninen62 at gmail.com
Sun Jan 10 13:29:41 CET 2021


I am profiling and optimizing code in Lazarus IDE.
Valgrind profiler + KCacheGrind visualizer tool make a very nice
combination.
A picture of KCacheGrind in real action :
 https://photos.app.goo.gl/YGn3uiNgciWPKSGx7

KCacheGrind is part of KDE project and thus integrates well with KDE Plasma
desktop.
Its authors have clearly profiled and optimized their own project. It opens
super-fast although it processes megabytes of complex data and draws fancy
graphics. Wow!
There are lists for callers and callees.
Data can be sorted by cumulative time, self time, number of calls, caller's
distance from the function etc.
Playing with it gives a good view of what is going on, and sometimes
unexpected surprises.
Usage instructions :
 https://wiki.freepascal.org/Profiling#Using_Valgrind.2FCallgrind

KCacheGrind opens by clicking the default output file, at least with my
KDE + Dolphin.
No need to generate any human readable text files. KCacheGrind makes it
human readable.

I built Lazarus with "-gw3 -gl -gv"
Martin builds without debug info with optimization. I will do the same
thing. Optimization does not do harm for profiling as it does for debugging.
-gv is the important flag for Valgrind profiler.

Recommended!

Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210110/5b135565/attachment.html>


More information about the lazarus mailing list