rm -f gmon.out
./ProfTest 1000000
run red black trees with inserting 1000000 elements in ascending order
card(s) = 1000000
minPathLength(s) = 19
maxPathLength(s) = 26
gprof --brief ./ProfTest gmon.out
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
48.89 0.44 0.44 1000000 0.00 0.00 insertElem1
28.89 0.70 0.26 26836444 0.00 0.00 checkBalanceRight
11.11 0.80 0.10 26836444 0.00 0.00 compare
2.22 0.82 0.02 1 20.00 20.00 card
2.22 0.84 0.02 1 20.00 30.00 maxPathLength
2.22 0.86 0.02 1 20.00 20.00 minPathLength
1.11 0.87 0.01 1000000 0.00 0.00 max
1.11 0.88 0.01 999974 0.00 0.00 balanceTrees
1.11 0.89 0.01 checkBalanceLeft
1.11 0.90 0.01 mkEmptySet
0.00 0.90 0.00 1000000 0.00 0.00 insertElem
0.00 0.90 0.00 1000000 0.00 0.00 min
0.00 0.90 0.00 1000000 0.00 0.00 mkNewRedNode

Call graph
granularity: each sample hit covers 4 byte(s) for 1.11% of 0.90 seconds
index % time self children called name
<spontaneous>
[1] 97.8 0.00 0.88 main [1]
0.00 0.81 1000000/1000000 insertElem [2]
0.02 0.01 1/1 maxPathLength [6]
0.02 0.00 1/1 card [7]
0.02 0.00 1/1 minPathLength [8]
-----------------------------------------------
0.00 0.81 1000000/1000000 main [1]
[2] 90.0 0.00 0.81 1000000 insertElem [2]
0.44 0.37 1000000/1000000 insertElem1 [3]
-----------------------------------------------
26836444 insertElem1 [3]
0.44 0.37 1000000/1000000 insertElem [2]
[3] 90.0 0.44 0.37 1000000+26836444 insertElem1 [3]
0.26 0.01 26836444/26836444 checkBalanceRight [4]
0.10 0.00 26836444/26836444 compare [5]
0.00 0.00 1000000/1000000 mkNewRedNode [14]
26836444 insertElem1 [3]
-----------------------------------------------
0.26 0.01 26836444/26836444 insertElem1 [3]
[4] 30.0 0.26 0.01 26836444 checkBalanceRight [4]
0.01 0.00 999974/999974 balanceTrees [10]
-----------------------------------------------
0.10 0.00 26836444/26836444 insertElem1 [3]
[5] 11.1 0.10 0.00 26836444 compare [5]
-----------------------------------------------
2000000 maxPathLength [6]
0.02 0.01 1/1 main [1]
[6] 3.3 0.02 0.01 1+2000000 maxPathLength [6]
0.01 0.00 1000000/1000000 max [9]
2000000 maxPathLength [6]
-----------------------------------------------
2000000 card [7]
0.02 0.00 1/1 main [1]
[7] 2.2 0.02 0.00 1+2000000 card [7]
2000000 card [7]
-----------------------------------------------
2000000 minPathLength [8]
0.02 0.00 1/1 main [1]
[8] 2.2 0.02 0.00 1+2000000 minPathLength [8]
0.00 0.00 1000000/1000000 min [13]
2000000 minPathLength [8]
-----------------------------------------------
0.01 0.00 1000000/1000000 maxPathLength [6]
[9] 1.1 0.01 0.00 1000000 max [9]
-----------------------------------------------
0.01 0.00 999974/999974 checkBalanceRight [4]
[10] 1.1 0.01 0.00 999974 balanceTrees [10]
-----------------------------------------------
<spontaneous>
[11] 1.1 0.01 0.00 checkBalanceLeft [11]
-----------------------------------------------
<spontaneous>
[12] 1.1 0.01 0.00 mkEmptySet [12]
-----------------------------------------------
0.00 0.00 1000000/1000000 minPathLength [8]
[13] 0.0 0.00 0.00 1000000 min [13]
-----------------------------------------------
0.00 0.00 1000000/1000000 insertElem1 [3]
[14] 0.0 0.00 0.00 1000000 mkNewRedNode [14]
-----------------------------------------------

Index by function name
[10] balanceTrees [2] insertElem [8] minPathLength
[7] card [3] insertElem1 [12] mkEmptySet
[11] checkBalanceLeft [9] max [14] mkNewRedNode
[4] checkBalanceRight [6] maxPathLength
[5] compare [13] min