[英]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.