Author: Sven Reichard
Date: 10:52:28 05/23/02
Go up one level in this thread
Thanks for your input. Cf. answer to Dr. Hyatt.
To give you a better idea, here is a short transcript. You see that gprof
doesn't notice that the program takes any time at all.
Cheers,
Sven.
[sven@localhost TestProfile]$ more main.cpp
void f(int depth)
{
if (! depth){
for (int i = 0; i < 10000; i++);
return;
}
f(depth-1);
f(depth-1);
};
int main()
{
f(15);
return 0;
};
[sven@localhost TestProfile]$ make
g++ -g -pg -c -o main.o main.cpp
g++ -g -pg -o main main.o
[sven@localhost TestProfile]$ time ./main
real 0m3.239s
user 0m1.670s
sys 0m0.000s
[sven@localhost TestProfile]$ gprof -b ./main
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls us/call us/call name
100.00 0.01 0.01 1 10000.00 10000.00 f(int)
Call graph
granularity: each sample hit covers 4 byte(s) for 100.00% of 0.01 seconds
index % time self children called name
65534 f(int) [1]
0.01 0.00 1/1 main [2]
[1] 100.0 0.01 0.00 1+65534 f(int) [1]
65534 f(int) [1]
-----------------------------------------------
<spontaneous>
[2] 100.0 0.00 0.01 main [2]
0.01 0.00 1/1 f(int) [1]
-----------------------------------------------
Index by function name
[1] f(int)
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.