Tougher recursion case
Matthew Mastracci <[email protected]> Sat, 27 Dec 2003 13:27:35 -0700
| Newsgroups | gmane.comp.windows.dotnet.nprof.devel |
|---|---|
| Message-ID | <[email protected]> |
Hot on the trails of fixing double-accounting in recursion, here's
another test case:
public void Run() // A
{
StartProjectRun( 0 );
}
void StartProjectRun( int nLevel ) // B
{
ProjectRun( nLevel );
}
void ProjectRun( int nLevel ) // C
{
Console.WriteLine( "ProjectRun Start" );
if ( nLevel == 0 )
{
ProjectRecursiveExecute( 1 );
ProjectRecursiveExecute( 2 );
}
else
{
DoSomethingElse( nLevel );
}
Console.WriteLine( "ProjectRun End" );
}
void ProjectRecursiveExecute( int nLevel ) // D
{
StartProjectRun( nLevel + 1 );
}
void DoSomethingElse( int nLevel ) // E
{
Console.WriteLine( "DoSomethingElse: " + 1000 );
Thread.Sleep( 1000 );
}
| A |
| B |
| C |
| D | D |
| B | B |
| C | C |
| E | E |
A: 1 call
% of total time in method and children: 100%
% of total time in method: 0%
% of total time in children: 100%
% of total time in recursion: 0%
Callees:
B: 1 call
% of parent: 100%
% of total: 100%
B: 3 calls
% of total time in method and children: 100%
% of total time in method: 0%
% of total time in children: 100%
% of total time in recursion: 100%
Callees:
C: 1 call
% of parent: 100%
% of total: 100%
C: 3 calls
% of total time in method and children: 100%
% of total time in method: 0%
% of total time in children: 100%
% of total time in recursion: 100%
Callees:
D: 2 calls
% of parent: 100%
% of total: 100%
E: 2 calls
% of parent: 100%
% of total: 100%
D: 2 calls
% of total time in method and children: 100%
% of total time in method: 0%
% of total time in children: 100%
% of total time in recursion: 0%
Callees:
B: 2 calls
% of parent: 100%
% of total: 100%
E: 2 calls
% of total time in recursion: 0%
% of total time in method and children: 100%
% of total time in method: 100%
% of total 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