我刚开始使用谷歌性能工具(google-perftools以及libgoogle-perftools4ubuntu中的软件包),我发誓我正在谷歌上搜索一天,我没有找到答案!问题是我没有通过CPU分析获得所有函数的结果.这是我的代码:
#include "gperftools/profiler.h"
#include <iostream>
#include <math.h>
using namespace std;
void bar()
{
int a,b,c,d,j,k;
a=0;
int z=0;
b = 1000;
while(z < b)
{
while (a < b)
{
d = sin(a);
c = cos(a);
j = tan(a);
k = tan(a);
k = d * c + j *k;
a++;
}
a = 0;
z++;
}
}
void foo()
{
cout << "hey " << endl;
}
int main()
{
ProfilerStart("/home/mohammad/gperf/dump.txt");
int a = 1000; …Run Code Online (Sandbox Code Playgroud)