侧边栏壁纸
博主头像
wxc博主等级

多接近生活,远离互联网

  • 累计撰写 49 篇文章
  • 累计创建 3 个标签
  • 累计收到 0 条评论
标签搜索

目 录CONTENT

文章目录

gperftools的使用

wxc
wxc
2020-09-15 / 0 评论 / 0 点赞 / 352 阅读 / 162 字

github地址

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

HEAP PROFILER

1) Link your executable with -ltcmalloc
2) Run your executable with the HEAPPROFILE environment var set:
     $ export HEAPPROFILE=/tmp/heapprof <path/to/binary> [binary args]
3) Run pprof to analyze the heap usage
     $ pprof <path/to/binary> /tmp/heapprof.0045.heap  # run 'ls' to see options
     $ pprof --gv <path/to/binary> /tmp/heapprof.0045.heap

CPU PROFILER

1) Link your executable with -lprofiler
2) Run your executable with the CPUPROFILE environment var set:
     $ export CPUPROFILE=/tmp/prof.out <path/to/binary> [binary args]
3) Run pprof to analyze the CPU usage
     $ pprof <path/to/binary> /tmp/prof.out      # -pg-like text output
     $ pprof --gv <path/to/binary> /tmp/prof.out # really cool graphical output

生成PDF文件

pprof --pdf ./executable pprof.out > pprof.pdf
0

评论区