[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/747] New: Profiling of nested functions
From: |
laurent at guerby dot net |
Subject: |
[Bug binutils/747] New: Profiling of nested functions |
Date: |
16 Feb 2005 12:16:53 -0000 |
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 10000000
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 seconds calls s/call s/call name
49.49 8.70 8.70 1 8.70 8.70 p3
34.13 14.70 6.00 1 6.00 6.00 p2
16.38 17.58 2.88 1 2.88 2.88 p1
[...]
index % time self children called name
<spontaneous>
[1] 100.0 0.00 17.58 main [1]
8.70 0.00 1/1 p3 [2]
6.00 0.00 1/1 p2 [3]
2.88 0.00 1/1 p1 [4]
-----------------------------------------------
8.70 0.00 1/1 main [1]
[2] 49.5 8.70 0.00 1 p3 [2]
-----------------------------------------------
20000000 p2 [3]
6.00 0.00 1/1 main [1]
[3] 34.1 6.00 0.00 1+20000000 p2 [3]
20000000 p2 [3]
-----------------------------------------------
2.88 0.00 1/1 main [1]
[4] 16.4 2.88 0.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/747] New: Profiling of nested functions,
laurent at guerby dot net <=