[Home]   [TOC]

Study_OS_Linux_Perftools  
google perftools
Updated Nov 20, 2014 by jht5...@gmail.com

perftools安装、分析过程

  1. http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99-beta.tar.gz
  2. configure; make; sudo make install
  3. http://google-perftools.googlecode.com/files/google-perftools-1.8.1.tar.gz
  4. configure –prefix=/home/user/perftools; make; sudo make install
  5. export
  6. export LD_PRELOAD=/home/hadoop/perftools/lib/libtcmalloc.so
    export HEAPPROFILE=/home/user/perftools/test
  7. 修改 lc_config:sudo vi /etc/ld.so.conf.d/usr_local_lib.conf,加入/usr/local/lib(libunwind的lib所在目录)
  8. 执行sudo /sbin/ldconfig,使libunwind生效
  9. 重启应用程序,应用程序会在/home/user/perftools/生成heap,名字包含pid
  10. pprof -text $JAVA_HOME/bin/java /home/admin/perftools/test_23106
    (注意如果配置crontab则ppof需要全路径去执行)
  11. 去发现那个占用内存最多类和方法名

Performance analysis tools based on Linux perf_events (aka perf) and ftrace - https://github.com/brendangregg/perf-tools

参考资料

[1]. http://impzx.com/%E5%A0%86%E5%A4%96%E5%86%85%E5%AD%98%E6%B3%84%E9%9C%B2%E7%9A%84%E5%88%86%E6%9E%90%E8%BF%87%E7%A8%8B/