I'm trying to optimize my program for speed. in the past I have compile and linked my program using g++ with the -pg tag to instrument the code for profiling. The run of the executable generated the expected file gmon.out. However when I'm using the command
gprof <name of executable> gmon.out
I get a bunch of errors such as: BFD: Sim(.rel.plt): relocation 0 has invalid symbol index 1
Then the table shows the number of time each function has been called but no timing information about how much time the CPU spent in this function. All timing information shows the value 0.
Example:
BFD: Sim(.rel.plt): relocation 0 has invalid symbol index 1
BFD: Sim(.rel.plt): relocation 1 has invalid symbol index 2
BFD: Sim(.rel.plt): relocation 2 has invalid symbol index 3
BFD: Sim(.rel.plt): relocation 3 has invalid symbol index 4
BFD: Sim(.rel.plt): relocation 4 has invalid symbol index 5
BFD: Sim(.rel.plt): relocation 5 has invalid symbol index 6
BFD: Sim(.rel.plt): relocation 6 has invalid symbol index 7
BFD: Sim(.rel.plt): relocation 7 has invalid symbol index 8
BFD: Sim(.rel.plt): relocation 8 has invalid symbol index 10
.....
BFD: Sim(.rel.plt): relocation 54 has invalid symbol index 62
BFD: Sim(.rel.plt): relocation 55 has invalid symbol index 63
BFD: Sim(.rel.plt): relocation 56 has invalid symbol index 64
BFD: Sim(.rel.plt): relocation 57 has invalid symbol index 66
Flat profile:
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 2953039 0.00 0.00 __gnu_cxx::__normal_iterat
or<Process
**, std::vector<Process*, std::allocator<Process*> > >::__normal_
iterator(Process** const&)
0.00 0.00 0.00 2890929 0.00 0.00 __gnu_cxx::__normal_iterat
or<Process
**, std::vector<Process*, std::allocator<Process*> > >::base() co
nst
0.00 0.00 0.00 1451477 0.00 0.00 std::vector<Process*, std::allocator<Process*> >::end()
0.00 0.00 0.00 1387588 0.00 0.00 bool __gnu_cxx::operator!=<Proc
ess**, std::vector<Process*, std::allocator<Process*> > >(__gnu_cxx::_
_normal_iterator<Process**
, std::vector<Process*, std::allocator<Process*> > > const&, __gnu_cxx::__normal_iterat
or<Process
**, std::vector<Process*, std::a
llocator<Process*> > > const&)
I have used prof in the past for profiling and it used to work just fine. RH4 has gprof instead and they say it should be 100% compatible to prof + it is GNU.
Any idea what am I doing wrong?
P.S. my program is multithreaded one. According to the documentation it should not be a problem.
Start Free Trial