|
From: Michael.Schmidt@L-3com.com - 2008-06-25 19:38:26
|
Hello, I'm trying to get a handle on cycles, and I don't understand the "Avoiding Cycles" section in the manual. If function A calls B, B calls C, and C calls A, I guess Kcachegrind is smart enough to detect the cycle. It then inserts a cycle node in the call graph. The cycle node will then appear as though it calls A, B, and C directly. A, B, and C will have "<cycle #>" next to their name. I guess my question is: What do the percentages under A, B, and C represent? It looks like the percentages for cycle functions are exclusive times. Is that correct? I'd appreciate any words of wisdom. Thanks, Mike |
|
From: Josef W. <Jos...@gm...> - 2008-06-25 22:22:15
|
On Wednesday 25 June 2008, Mic...@l-... wrote: > Hello, > > I'm trying to get a handle on cycles, and I don't understand the "Avoiding Cycles" section in the manual. If function A calls B, B calls C, and C calls A, I guess Kcachegrind is smart enough to detect the cycle. It then inserts a cycle node in the call graph. The cycle node will then appear as though it calls A, B, and C directly. A, B, and C will have "<cycle #>" next to their name. Yes, that is right. Same as GProf is doing. > I guess my question is: What do the percentages under A, B, and C represent? What is "under" in this question? I suppose you talk about the inclusive cost shown. It is the exclusive cost of the function plus the inclusive cost of all called functions which are _outside_ of the cycle. So the definition for "inclusive cost" of a function in a cycle differs from "inclusive cost" of non-cycle functions by ignoring callees in the same cycle. This also makes it easy to calculate the correct inclusive cost of a full cycle: Just add up the inclusive costs of its members. This automatically then ignores all inner-cycle calls. This matches with the general definition of "inclusive cost" for the artifical cycle funtion: Exclusive cost (=sum of exclusive cost of all cycle members) plus inclusive cost of all callees of the cycle (= all callees of cycle members to the outside of the cycle). > It looks like the percentages for cycle functions are exclusive times. Is that correct? Not really. As said above, you also add the cost of the calls going out of the cycle. > I'd appreciate any words of wisdom. I hope this explains the issue. Cheers, Josef PS: This probably should be part of the KCachegrind manual ... > > Thanks, > Mike > |