google-perftools安裝

source link:http://blog.sina.com.cn/s/blog_704836f40100yvyx.html

1.編譯libunwind

 

因爲使用的是X86_64Linux系統,因此需要安裝libunwind庫。

安裝方法很簡單,常見的configure,make,make install的套路。

 

wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99-beta.tar.gz

tar xvzf libunwind-0.99-beta.tar.gz

cd libunwind-0.99-beta

./configure

make

make install

 

因爲默認的libunwind安裝在/usr/local/lib目錄下,需要將這個目錄添加到系統動態庫緩存中。

 

echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig

 

libunwind的最新版本是1.0.1,那爲什麼不選擇最新版本呢?google perftoolsINSTALL文件中給了說明。版本低於0.99-betalibunwindpreftools一起工作可能不正常,但是高於0.99-beta的版本中可能包含一些與perftools不兼容的代碼(因爲libunwind會調用malloc,可能會導致死鎖)libunwindX86_64平臺上和perftools有不少問題,不過不會影響核心的tcmalloc庫,但是會影響perftools中的工具,例如cpu-profiler, heap-checker,heap-profiler。

 

2.編譯google-perftools

 

因爲我們只需要tcmalloc功能,因此不編譯google-perftools中的其他工具。

wget http://gperftools.googlecode.com/files/google-perftools-1.9.1.tar.gz

tar xvzf google-perftools-1.9.1.tar.gz

cd google-perftools-1.9.1

./configure --disable-cpu-profiler --disable-heap-profiler --disable-heap-checker --enable-minimal--disable-dependency-tracking

make

make install

/sbin/ldconfig


一些有關係的文檔連接:

http://goog-perftools.sourceforge.net/doc/tcmalloc.html

http://wiki.nginx.org/GooglePerftoolsModule

http://www.centos.bz/2012/01/google-perftools-speed-up-mysql-tcmalloc/

http://blog.ops.tudou.com/wp/?p=96

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章