我是新来GPROF,这是我的计划,
#include<stdio.h>
int somefunc(int n)
{
int i,j;
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
printf("%d\t",j);
}
printf("\n");
}
}
int somefunc1(int n)
{
int i,j;
for(i=n;i>=1;i--){
for(j=i;j>=1;j--){
printf("%d\t",j);
}
printf("\n");
}
}
int main()
{
printf("Hello\n");
int n;
printf("enter n value\n");
scanf("%d",&n);
somefunc(n);
printf("another\n\n");
somefunc1(n);
printf("another\n") ;
}
我想这一点,
gcc -pg program.c
./a.out
gprof a.out gmon.out
和它不diaplaying时间,即它被显示,即使它正在超过20分钟0.0%的时间? 输出是这样的,
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 1 0.00 0.00 somefunc
0.00 0.00 0.00 1 0.00 0.00 somefunc1