[Bug binutils/747] New: Profiling of nested functions

2005-02-16 Thread laurent at guerby dot net
It looks like nested functions are not properly reported by gprof.
The original problem was on Ada code with nested
functions. This is with GCC from CVS HEAD 20050213 and GNU gprof 2.15.91.0.2
on a x86 SuSE 9.2 system. A GCC developper suggested that the appropriate calls
seemed to be generated properly, so the problem was likely in gprof.

$ cat cn.c
#define N 1000
static int sum=0;
void p1(void) {
  int i;
  for(i=1;i<=N;i++) sum+=(i+1)/i;
}
void p2(void) {
  int f2(int x) {
return x;
  }
  int i;
  for(i=1;i<=2*N;i++) sum+=f2(i+1)/i;
}
void p3(void) {
  int i;
  for(i=1;i<=3*N;i++) sum+=(i+1)/i;
}

int main(void) {
  p1();
  p2();
  p3();
  return 0;
}
$ gcc -pg -g cn.c 
$ ./a.out
$ gprof ./a.out 
[...]
Flat profile:
  %   cumulative   self  self total   
 time   seconds   secondscalls   s/call   s/call  name
 49.49  8.70 8.701 8.70 8.70  p3
 34.13 14.70 6.001 6.00 6.00  p2
 16.38 17.58 2.881 2.88 2.88  p1
[...]
index % timeself  childrencalled name
 
[1]100.00.00   17.58 main [1]
8.700.00   1/1   p3 [2]
6.000.00   1/1   p2 [3]
2.880.00   1/1   p1 [4]
---
8.700.00   1/1   main [1]
[2] 49.58.700.00   1 p3 [2]
---
 2000 p2 [3]
6.000.00   1/1   main [1]
[3] 34.16.000.00   1+2000 p2 [3]
 2000 p2 [3]
---
2.880.00   1/1   main [1]
[4] 16.42.880.00   1 p1 [4]
---

-- 
   Summary: Profiling of nested functions
   Product: binutils
   Version: 2.15
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: laurent at guerby dot net
CC: bug-binutils at gnu dot org


http://sources.redhat.com/bugzilla/show_bug.cgi?id=747

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/747] Profiling of nested functions

2005-02-16 Thread pinskia at gcc dot gnu dot org


-- 
   What|Removed |Added

 CC||pinskia at gcc dot gnu dot
   ||org


http://sources.redhat.com/bugzilla/show_bug.cgi?id=747

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Difference in "cumulative time" in gprof's report and "TIME" in top output

2005-02-16 Thread Tulsi Ram Mayala








[EMAIL PROTECTED] strongmail-server]$ time
./system/bin/strongmail-server -i ./ -p 9010

 

real    9m59.540s

user    5m37.470s

sys 0m2.330s

[EMAIL PROTECTED] strongmail-server]$

 

 

[EMAIL PROTECTED] strongmail-server]$ gprof -q
./system/bin/strongmail-server | more


Call graph (explanation follows)

 

 

granularity: each sample hit covers 4 byte(s) for 0.03% of
36.18 seconds

 

index % time    self 
children    called name




[1] 92.7   
0.00  
33.53
main [1]

 

 

Why does the “time” says 5mins and 37 secs
whereas the “gprof” says only 36.18 secs? Does gprof exclude
anything?

 

Strongmail-server exited with exit(0)

 

Also, we are using memcpy in our code. The “gprof
–qz” doesn’t list it anywhere in the callgraph.

 

We are using “GNU gprof 2.14.90.0.4”



 

 

- Tulsi Ram.

 





http://www.strongmailsystems.com





 





Don't Just Send. 
Deliver.
High Performance Infrastructure for Email Delivery



 






___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils