Recursive function double-accounting

Matthew Mastracci <[email protected]> Sat, 27 Dec 2003 12:47:00 -0700
Newsgroups gmane.comp.windows.dotnet.nprof.devel
Message-ID <[email protected]>
Looks like I'm double-accounting in the case of recursive functions. 
This is a tricky one to solve.  I think I'm going to try to keep track 
of the top-level recursive function and work from there.

Here's an example:

|  A                                                        |
|     B      |     B      |  C  |            D              |
|     C      |     C      |  A  |
|  A  |  A   |  A  |  A   |

On the second run, each B is 20%, C is 10% and D is 50%

The lowest level A sleeps for 10%
D sleeps for 50%

A() calls B twice, C once and D once.  Each invocation of B calls one 
invocation of C.  Each invocation of C calls A twice.  I think the final 
numbers for this situation should look like this:

A: 6 calls
% of total time in method and children: 100%
% of total time in method: 50%
% of total time in children: 50%
% of method time in children: 50%
Callees:
B: 2 calls
% of parent: 40%
% of total: 40%
C: 1 call
% of parent: 10%
% of total: 10%
D: 1 call
% of parent: 50%
% of total: 50%

B: 2 calls
% of total time in method and children: 40%
% of total time in method: 0%
% of total time in children: 40%
% of method time in children: 100%
Callees:
C: 2 calls
% of parent: 100%
% of total: 40%

C: 3 calls
% of total time in method and children: 50%
% of total time in method: 0%
% of total time in children: 50%
% of method time in children: 100%
Callees:
A: 5 calls
% of parent: 100%
% of total: 50%

D: 1 call
% of total time in method and children: 50%
% of total time in method: 50%
% of total time in children: 0%
% of method time in children: 0%
Callees:
(none)



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click