3.2.1 : Profiling the code

To profile the program hadamard_product_profiling we are going to use a specific tool of valgrind : callgrind.



To do so, we have to execte the following command :

valgrind --tool=callgrind ./hadamard_product_profiling
==6669== Callgrind, a call-graph generating cache profiler
==6669== Copyright (C) 2002-2017, and GNU GPL'd, by Josef Weidendorfer et al.
==6669== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==6669== Command: ./hadamard_product_profiling
==6669== 
==6669== For interactive control, run 'callgrind_control -h'.
Hadamard product
tabResult[0] = 0
tabResult[0] = 0
tabResult[0] = 0
tabResult[0] = 0
tabResult[0] = 0
==6669== 
==6669== Events    : Ir
==6669== Collected : 3221517
==6669== 
==6669== I   refs:      3,221,517


Valgrind told us he collected 3 221 517 events (calls in general).

If we print the content of the current directory, we find a new file :



ls
CMakeFiles  callgrind.out.6669  cmake_install.cmake  hadamard_product_profiling  Makefile


The file callgrind.out.6669, which contains the profiling informations.

Now, we are ready to visualise the results.