Profile工具-gperftools(一):CPU feature

簡介

  • gperftools 原名 Google Performance Tools,是一套可以做 profile 的工具,由 google 提供。
  • 目前看來在 Linux 上特別的好使,Windows 基本不能用(官網說 Windows 正在開發,不知道會不會有下文)
  • CPU profile 只是這個工具其中一個 feature,我們就用這個 feature。
  • 其他 feature 還有 tcmalloc:一個比malloc更快的內存管理算法;還有 heap profiler,heap checker。
  • 官網:https://github.com/gperftools/gperftools
  • 參考:http://www.cnblogs.com/lenolix/archive/2010/12/13/1904868.html

一. 安裝

git clone https://github.com/gperftools/gperftools.git
cd gperftools
./autogen.sh
./configure
make
sudo make install

目錄結構:

tree .
.
├── bin
│   └── pprof
├── include
│   ├── google
│   │   ├── heap-checker.h
│   │   ├── heap-profiler.h
│   │   ├── malloc_extension_c.h
│   │   ├── malloc_extension.h
│   │   ├── malloc_hook_c.h
│   │   ├── malloc_hook.h
│   │   ├── profiler.h
│   │   ├── stacktrace.h
│   │   └── tcmalloc.h
│   └── gperftools
│       ├── heap-checker.h
│       ├── heap-profiler.h
│       ├── malloc_extension_c.h
│       ├── malloc_extension.h
│       ├── malloc_hook_c.h
│       ├── malloc_hook.h
│       ├── nallocx.h
│       ├── profiler.h
│       ├── stacktrace.h
│       └── tcmalloc.h
├── lib
│   ├── libprofiler.a
│   ├── libprofiler.la
│   ├── libprofiler.so -> libprofiler.so.0.4.18
│   ├── libprofiler.so.0 -> libprofiler.so.0.4.18
│   ├── libprofiler.so.0.4.18
│   ├── libtcmalloc.a
│   ├── libtcmalloc_and_profiler.a
│   ├── libtcmalloc_and_profiler.la
│   ├── libtcmalloc_and_profiler.so -> libtcmalloc_and_profiler.so.4.5.3
│   ├── libtcmalloc_and_profiler.so.4 -> libtcmalloc_and_profiler.so.4.5.3
│   ├── libtcmalloc_and_profiler.so.4.5.3
│   ├── libtcmalloc_debug.a
│   ├── libtcmalloc_debug.la
│   ├── libtcmalloc_debug.so -> libtcmalloc_debug.so.4.5.3
│   ├── libtcmalloc_debug.so.4 -> libtcmalloc_debug.so.4.5.3
│   ├── libtcmalloc_debug.so.4.5.3
│   ├── libtcmalloc.la
│   ├── libtcmalloc_minimal.a
│   ├── libtcmalloc_minimal_debug.a
│   ├── libtcmalloc_minimal_debug.la
│   ├── libtcmalloc_minimal_debug.so -> libtcmalloc_minimal_debug.so.4.5.3
│   ├── libtcmalloc_minimal_debug.so.4 -> libtcmalloc_minimal_debug.so.4.5.3
│   ├── libtcmalloc_minimal_debug.so.4.5.3
│   ├── libtcmalloc_minimal.la
│   ├── libtcmalloc_minimal.so -> libtcmalloc_minimal.so.4.5.3
│   ├── libtcmalloc_minimal.so.4 -> libtcmalloc_minimal.so.4.5.3
│   ├── libtcmalloc_minimal.so.4.5.3
│   ├── libtcmalloc.so -> libtcmalloc.so.4.5.3
│   ├── libtcmalloc.so.4 -> libtcmalloc.so.4.5.3
│   ├── libtcmalloc.so.4.5.3
│   └── pkgconfig
│       ├── libprofiler.pc
│       ├── libtcmalloc_debug.pc
│       ├── libtcmalloc_minimal_debug.pc
│       ├── libtcmalloc_minimal.pc
│       └── libtcmalloc.pc

二. 使用

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