Actualizar 'Performance Analysis setup'
parent
f224f1e512
commit
fb7bdbdc12
|
@ -1,2 +1,107 @@
|
||||||
# Performance with Vtune:
|
# Performance with Vtune:
|
||||||
|
|
||||||
|
## Use Vtunes for Hotspot profiling:
|
||||||
|
|
||||||
|
1. With GUI:
|
||||||
|
|
||||||
|
From terminal open with vtune-gui and open your project for analysis.
|
||||||
|
At first this will generate a flat profile where you can choose the hotspot options.
|
||||||
|
|
||||||
|
2. In Terminal:
|
||||||
|
|
||||||
|
from terminal use the command:
|
||||||
|
|
||||||
|
vtunne -collect hotspots ./<source-excecutable>
|
||||||
|
|
||||||
|
|
||||||
|
# Performance with Gprof:
|
||||||
|
|
||||||
|
## Use Gprof for Flat and Function Call Graph profiling:
|
||||||
|
|
||||||
|
### SETUP
|
||||||
|
|
||||||
|
Compile and build the project in terminal with this line of code before make:
|
||||||
|
|
||||||
|
|
||||||
|
cmake -DCMAKE_CXX_FLAGS=-pg -DCMAKE_EXE_LINKER_FLAGS=-pg -DCMAKE_SHARED_LINKER_FLAGS=-pg <SOURCE_DIR>
|
||||||
|
|
||||||
|
|
||||||
|
The directory should be where you have the Cmake file for the project.
|
||||||
|
|
||||||
|
### ANALYSIS
|
||||||
|
|
||||||
|
After this, this will generate a gmon.out file:
|
||||||
|
|
||||||
|
Go to the directory where gmon.out file is located and analyse with:
|
||||||
|
|
||||||
|
|
||||||
|
gprof -p ./<excecutable> >[outputfilename with directory]
|
||||||
|
|
||||||
|
|
||||||
|
for a flat profiling of times.
|
||||||
|
|
||||||
|
And for a call graph:
|
||||||
|
|
||||||
|
|
||||||
|
gprof -q ./<excecutable> >[outputfilename with directory]
|
||||||
|
|
||||||
|
|
||||||
|
### Visualisation:
|
||||||
|
|
||||||
|
The output files can be opened with any text editor.
|
||||||
|
|
||||||
|
|
||||||
|
# Performance with Valgrind:
|
||||||
|
|
||||||
|
## Use Gprof for Cache and Call Graph analysis:
|
||||||
|
|
||||||
|
### SETUP
|
||||||
|
|
||||||
|
|
||||||
|
Build with RelWithDebInfo option so that SIGILL does not appear (illegal opcode)
|
||||||
|
|
||||||
|
|
||||||
|
### ANALYSIS
|
||||||
|
|
||||||
|
|
||||||
|
Go to the build you want to analyse with cd <source-of-build>
|
||||||
|
|
||||||
|
|
||||||
|
Cache Analysis:
|
||||||
|
|
||||||
|
|
||||||
|
valgrind --tool=cachegrind ./bin/<excecutable>
|
||||||
|
|
||||||
|
|
||||||
|
this will generate a cachegrind.out.<id> file in the directory where you analysed, which you can annotate using.
|
||||||
|
|
||||||
|
|
||||||
|
Cache Analysis Presentation:
|
||||||
|
|
||||||
|
|
||||||
|
cg_annotate cachegrind.out.<id>
|
||||||
|
|
||||||
|
|
||||||
|
Function Call Analysis:
|
||||||
|
|
||||||
|
|
||||||
|
valgrind --tool=callgrind ./bin/<excecutable>
|
||||||
|
|
||||||
|
|
||||||
|
this will generate a cachegrind.out.<id> file in the directory where you analysed, which you can annotate using.
|
||||||
|
|
||||||
|
|
||||||
|
Cache Analysis Presentation:
|
||||||
|
|
||||||
|
|
||||||
|
cg_annotate cachegrind.out.<id>
|
||||||
|
|
||||||
|
### GUI Presentation:
|
||||||
|
|
||||||
|
|
||||||
|
All the .out files can be presented through KCachegrind. Open it from the GUI. Errors may appear if you want to open them directly from terminal.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue