I am new to gprof, this is my program,
#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") ;
}
and i tried this,
gcc -pg program.c
./a.out
gprof a.out gmon.out
and it is not diaplaying time, i e it is displaying 0.0% time even if it is taking more than 20 min? output is like this,
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