1 Valgrind is a powerful tool for performance and correctness analysis of code.
2 This mini-howto discusses how to set your development environment up,
3 such that you can profile or leakcheck a running olsr daemon and later analyze its
4 recordings using a graphical frontend called Kcachegrind.
6 First change your makefile.inc such that the debug symbols are not removed after
9 # set DEBUG to 1 to add debugger symbols to olsrd and filename/linenumbers to logging
10 # set DEBUG to 0 to remove both and optimize olsrd for size
13 # set to 1 to remove a severity level of logging from olsrd
19 valgrind for profiling:
21 run valgrind with the following command line options.
23 valgrind --tool=callgrind -v --dump-instr=yes --trace-jump=yes ./olsrd -d 0 -nofork
25 Finally load kcachgrind to display the profiling data. (watch out the callgrind
26 data are written with a umask of 600 as user root - so you may want to chown or
27 chmod the file, otherwise kcachegrind cannot open your data and will display an
30 valgrind for memory checking:
32 valgrind --tool=memcheck --leak-check=full --show-reachable=yes ./olsrd --nofork -f /etc/olsrd.conf -d 0