性能优化工具gprof & 内存检测工具Valgrind 用法

gprof:

//加-pg选项

$ gcc -Wall -g -pg test.c -o test

//生成gmon.out

$ ./test

//生成性能检测报告

$ gprof -b test gmon.out

 

Valgrind:

//加-g编译

$ gcc -g -o test test.c

//生成内存检查报告

$ valgrind --tool=memcheck --leak-check=yes ./test

 

你可能感兴趣的:(gcc,性能优化,工具)