User:Matt1/sandbox/profiling tuto

= Profiling with callgrind/valgrind/Kcachegrind on Linux X86 =

First: Get OOo4kids source and compile
To compile sources: global instruction

For Ubuntu: User:Benbois/Sandbox

For Mandriva: User:Matt1/sandbox/compilation_mandriva

Second: Get tools
Install Valgrind, Kcachegrind and graphviz on your system. Callgrind is included with Valgrind.

Mandriva
urpmi Kcachegrind valgrind graphviz

third: execute valgrind

 * go in instsetoo_native/unxlngi6.pro/OOo4Kids/installed/install/en-US/ooo4kids0.9/program


 * execute valgrind with callgrind

valgrind --tool=callgrind --separate-threads=no --instr-atstart=yes ./soffice


 * if you want profile directly swriter, scalc or other, do not use ./swriter because valgrind will not collect data but use argument:

valgrind --tool=callgrind --separate-threads=no --instr-atstart=yes ./soffice -swriter


 * wait, soffice is launched. Use function you want test.

fourth: execute Kcachegrind

 * Open Kcachegrind
 * Open your data : callgrind.out

You can sort by function, source etc...


 * in the column "location", source library appears.


 * On the right you can see a map with function and the graph calls.

Fifth: see source code
If you want to see source code, you need to recompile module where is the librairie, with option debug.

rm -rf unxlngi6.pro
 * go to in this module
 * delete unxlngi6.pro

build --ENVCFLAGS+=-g -P2
 * build with --ENVCFLAGS+=-g


 * add /module/unxlngi6.pro/lib in configure/annotations in Kcachegring


 * go to third then fourth


 * In Kcachegrind you can examine this library recompiled, you see source with percent time of processor on the right.