From: "Markus Schöpflin" <no.spam@spam.spam>
Subject: Profiling Ada binaries
Date: Fri, 22 Jul 2016 15:24:31 +0200
Date: 2016-07-22T15:24:31+02:00 [thread overview]
Message-ID: <nmt6qe$3d6$1@gioia.aioe.org> (raw)
Dear list,
I realize that the following question is rather vague, but I hope that perhaps
someone can give me some advice on how to proceed, or maybe has already
experienced similar issues.
I am trying to profile code generated by Gnat using Gprof. For this I add -pg
to the compilation and link switches, turn down optimization to -O1 and
disable inlining of functions only called once
(-fno-inline-functions-called-once).
The result obtained when running gprof to generate the report from the
profiling data gathered during running the executable is rather strange, as
the report suggests that e.g. elaboration functions of compilation units are
called countless times, which of course most likely isn't true.
To illustrate, here are the first few lines of a flat profile:
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
4.66 4.91 4.91 429 0.01 0.01 foo1
4.41 9.55 4.64 162635540 0.00 0.00 bar___elabs
3.99 13.76 4.21 515639 0.00 0.00 foo2
As one can see, the second line suggests that the elaboration for the spec of
the package bar is called 162635540 times. Looking at the call graph of
bar___elabs shows:
0.00 0.00 1/162635540 adainit [92]
0.00 0.00 33/162635540
standard_math__float_32_elementary__arccosX [2249]
0.00 0.00 1461/162635540
standard_math__float_32_elementary__arcsinX [1099]
0.00 0.00 108848/162635540
standard_math__float_64_elementary__arctanX [1573]
0.00 0.00 109380/162635540
standard_math__float_64_elementary__sinX [1572]
0.00 0.00 163937/162635540
standard_math__float_64_elementary__cosX [687]
0.01 0.00 515639/162635540
standard_math__float_32_elementary__OexponX [609]
0.03 0.00 1029874/162635540
standard_math__float_32_elementary__tanX [346]
0.04 0.00 1358089/162635540
standard_math__float_64_elementary__sqrtX [454]
0.04 0.00 1543778/162635540
standard_math__float_32_elementary__logX [558]
0.50 0.00 17564360/162635540
standard_math__float_32_elementary__expX [93]
0.56 0.00 19681964/162635540
standard_math__float_32_elementary__arctanX [56]
0.79 0.00 27790226/162635540
standard_math__float_32_elementary__cosX [51]
0.82 0.00 28730603/162635540
standard_math__float_32_elementary__sinX [49]
1.83 0.00 64037347/162635540
standard_math__float_32_elementary__sqrtX [45]
[33] 4.4 4.64 0.00 162635540 bar___elabs [33]
There is one legit call from adainit, all other reported calls are most likely
incorrect. The many calls to standard math functions most likely are correct,
they just don't call bar___elabs.
Did anybody encounter such anomalies before? Is there a way to get correct
profiling information for Ada binaries generated by Gnat? Different compiler
flags maybe? Or using a different profiling tool altogether?
TIA,
Markus
next reply other threads:[~2016-07-22 13:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 13:24 Markus Schöpflin [this message]
2016-07-22 14:59 ` Profiling Ada binaries Alejandro R. Mosteo
2016-07-22 15:05 ` Alejandro R. Mosteo
2016-07-25 7:01 ` Markus Schöpflin
2016-07-25 16:45 ` rieachus
2016-07-25 17:14 ` Simon Wright
2016-07-25 22:05 ` rieachus
2016-07-26 8:37 ` Markus Schöpflin
2016-08-01 22:40 ` rieachus
2016-08-01 23:36 ` Jeffrey R. Carter
2016-08-02 7:00 ` Markus Schöpflin
2016-08-05 3:18 ` rieachus
2016-08-05 20:27 ` Randy Brukardt
2016-08-02 6:39 ` Markus Schöpflin
2016-07-25 6:57 ` Markus Schöpflin
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox