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?
#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; }
-- 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