What is gperftools (and How to use it)

See https://gperftools.github.io/gperftools/cpuprofile.html

gperftools in OSX

In MacOS, gperftools can be installed via HomeBrew with brew install gperftools.

How to use pprof to generate report

By following the instructions described in the link above, profiler output can be generated. However, we could not directly use pprof shipped with HomeBrew or gpertools (installed via HomeBrew). Otherwise, you will encounter problems described in this issue.

To solve this problem, we need to use pprof provided by Google. To install it, follow the instructions on its README.

After installing pprof, if you want to generate graphs, install graphviz via HomeBrew: brew install graphviz.

Now, gpertools and pprof are ready to use.

Understanding the Graph

To understand the meaning of the graph (generated with options like --png, --gif, --pdf…), we can see the Graphical reports section in pprof documentation.