Skip to content
Aliaksiej Kandracienka (aka Aliaksei Kandratsenka) edited this page Sep 26, 2024 · 21 revisions

gperftools Build Status

(originally Google Performance Tools)

One of the fastest mallocs; works particularly well with threads and STL. Also: heap-profiler, and cpu-profiler.

Overview

gperftools is a collection of a high-performance multi-threaded malloc() implementation, plus some pretty nifty performance analysis tools.

gperftools is distributed under the terms of the BSD License.

Downloads

For downloads, please visit our Downloads Page.

Example

Note: this is by no means complete documentation, but simply gives you an idea of what the API is like.

No recompilation is necessary to use these tools.

TC Malloc:

gcc [...] -ltcmalloc

All our profilers output format that needs pprof program. Get it by e.g.:

go install github.com/google/pprof@latest

Then consider adding $HOME/go/bin to your PATH.

Heap Profiler:

gcc [...] -o myprogram -ltcmalloc
HEAPPROFILE=/tmp/netheap ./myprogram
pprof --web ./myprogram /tmp/profile

Cpu Profiler:

gcc [...] -o myprogram -lprofiler
CPUPROFILE=/tmp/profile ./myprogram
pprof --web ./myprogram /tmp/profile

Sample Output

The heap profiler can pop up a window that displays information as a directed graph:

heap example1

The cpu profiler can produce a weighted call graph:

pprof vsnprintf
  • robbinfan’s cloud-perf, a simple web service that enables remote profiling and generate svg/flamegraph via pprof.

Questions and Feedback

If you have questions, comments, or feedback, please direct them to gperftools@googlegroups.com.