git clone --recursive [email protected]:dwangxxx/gperftools_flamegraph_profiler.gitgit clone https://github.com/gperftools/gperftools.git
sudo apt-get install libunwind8-dev
cd gperftools
./autogen.sh
./configure
make -j8
sudo make install
ldconfigg++ gperf_test.cc -o gperf_test -lprofiler
# use you own LD_PRELOAD path
LD_PRELOAD=/usr/local/lib/libprofiler.so.0 CPUPROFILE=./profiler.prof ./gperf_testpython3 gperf2flamegraph.py gperf_test profiler.prof --svg-output ./profiler.svg --text-output ./profiler.txtNote: FlameGraph is from https://github.com/brendangregg/FlameGraph