gperftools-2.0 をインストールしましたが、CPU プロファイル統計を取得できません
以下は、統計を取得するための私の手順です。
- gperftools tar -xzvfj gperftools-2.0.tar.gz をインストールします。
2.cppファイルtest.cppを編集
#include <stdio.h>
#include <gperftools/profiler.h>
int main()
{
ProfilerStart("test.prof");
for (int i = 0; i<100; i++)
{
printf("hello world!");
}
ProfilerStop();
return 0;
}
g++ test.cpp をコンパイル -o テスト -O0 -I/usr/local/include/ -L/usr/local/lib/ -lprofiler
実行./テスト
レポート pprof ./test --text test.prof
その出力は: Using local file ./test. ローカル ファイル test.prof を使用します。
私の手順で何が問題になっていますか?