Author: Muhammad F. Kasim
gdb
- Compile with
-g
flag - Type in the terminal:
gdb ./executable
- In the
gdb
window, type:
r
bt
perf
- Turn on the OpenMP parallelization by adding flag
-fopenmp
- Compile with
-g
flag - Type in the terminal:
sudo perf c2c record ./executable
sudo perf c2c report -i perf.data
valgrind
- Compile with
-g
flag - Type in the terminal:
valgrind --leak-check=full --undef-value-errors=no -v ./executable
valgrind
will report the memory leaks in the stdout
gprof
(usually installed withgcc
)
- Compile with flags
-g -pg -no-pie
- Type in the terminal:
./executable
gprof ./executable gmon.out > analysis.test
less analysis.test