Valgrind下載與安裝git
一、下載:github
valgrind官網:http://valgrind.org下載性能
二、安裝spa
cd valgrind ./autogen.sh ./configure --prefix=... make make install
三、執行code
/opt/soft/valgrind/bin/valgrind --tool=memcheck --leak-check=full --log-file=./2log.txt ./test [程序參數]
gperftools下載與安裝 blog
一、下載及安裝libunwind
下載地址: http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gzit
安裝:class
./configure --prefix=/home/your_name/tools/libunwind/ CFLAGS=-U_FORTRIFY_SOURCE make make install
二、下載及安裝gperftools
git地址:https://github.com/gperftools/gperftools
安裝:test
./configure --prefix=/home/your_name/tools/gperftools LDFLAGS=-L/home/your_name/tools/libunwind/lib
CPPFLAGS=-I/home/your_name/tools/libunwind/include make make install
三、執行file
//性能檢測 env LD_PRELOAD="/opt/soft/gperft/lib/libprofiler.so" CPUPROFILE_FREQUENCY=100 CPUPROFILE=cpu_perf.prof ./test /opt/soft/gperft/bin/pprof --text ./test cpu_perf.prof > cpu_perf.text