[英]i have installed gperftools-2.0, but i can't get cpu profile statistics
我已經安裝了gperftools-2.0,但是我無法獲取CPU配置文件統計信息
以下是我獲取統計信息的步驟:
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 test -O0 -I / usr / local / include / -L / usr / local / lib / -lprofiler
運行./test
報告pprof ./test --text test.prof
其輸出是:使用本地文件./test。 使用本地文件test.prof。
我的步驟有什么問題?
您只需要讓程序運行更長的時間即可,因為Google探查器只會每隔一段時間更新一次CPU統計信息。 重置“ CPUPROFILE_FREQUENCY”或“ CPUPROFILE_REALTIME”值可以更改此間隔時間。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.