* Problem with gprof for code containing static functions
@ 2014-07-09 7:49 Dragos Tarcatu
0 siblings, 0 replies; only message in thread
From: Dragos Tarcatu @ 2014-07-09 7:49 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 1665 bytes --]
I've been encountering some problems using gprof (GNU gprof (GNU Binutils) 2.24.51.20140623) in the most recent cygwin (32 bits) . Basically gprof seems to be missing static functions calls in the flat profile report. For the attached source file (compiled with -Wall -g -pedantic -std=c99 -pg -O0) if I disable the USE_STATIC macro the flat report seems ok.
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
89.24 1.99 1.99 100000000 0.00 0.00 f5
8.07 2.17 0.18 _mcount_private
1.79 2.21 0.04 1000000 0.00 0.00 f4
0.90 2.23 0.02 _fentry__
0.00 2.23 0.00 10000 0.00 0.00 f3
0.00 2.23 0.00 100 0.00 0.02 f2
0.00 2.23 0.00 1 0.00 2.03 f1
But if I enable it (making those functions static) I get pretty weird results:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
87.78 1.94 1.94 f5
8.60 2.13 0.19 _mcount_private
1.81 2.17 0.04 _fentry__
1.81 2.21 0.04 f4
0.00 2.21 0.00 101010000 0.00 0.00 __gcc_deregister_frame
0.00 2.21 0.00 100 0.00 0.00 f2
0.00 2.21 0.00 1 0.00 0.00 f1
Is this a known issue?
[-- Attachment #2: test.c --]
[-- Type: text/plain, Size: 691 bytes --]
#include<stdio.h>
#include<stdlib.h>
#define N1 100
#define N2 100
#define N3 100
#define N4 100
#define USE_STATIC
#ifdef USE_STATIC
static
#endif
void f5() {
int i;
for (i = 0; i < 10; i++) {
}
}
#ifdef USE_STATIC
static
#endif
void f4() {
int i;
for (i = 0; i < N4; i++) {
f5();
}
}
#ifdef USE_STATIC
static
#endif
void f3() {
int i;
for (i = 0; i < N3; i++) {
f4();
}
}
void f2() {
int i;
for (i = 0; i < N2; i++) {
f3();
}
}
void f1() {
int i;
for (i = 0; i < N1; i++) {
f2();
}
}
int main() {
f1();
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 218 bytes --]
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-07-09 7:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-09 7:49 Problem with gprof for code containing static functions Dragos Tarcatu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).