Bug 9783 – profiling recursive function calls yields bad tree timing
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-22T02:47:00Z
Last change time
2015-06-09T05:14:56Z
Assigned to
nobody
Creator
r.sagitario
Comments
Comment #0 by r.sagitario — 2013-03-22T02:47:23Z
Compiling this code:
int foo(int n)
{
if (n <= 0)
return 0;
return foo(n-1) + foo(n-2);
}
void main()
{
foo(30);
}
with "dmd -profile test.d" and exceuting it yields a trace.log containing
Num Tree Func Per
Calls Time Time Call
4356617 4337248 201989 0 int test.foo(int)
1 201989 0 0 _Dmain
that reports that the tree time of foo was a lot larger than the tree time of its only caller.
Comment #1 by github-bugzilla — 2013-03-22T12:49:15Z