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
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/f84708e9cb4811ad7b71f104c7c9704672665124 fix issue 9783: fix tree time when profiling recursive functions https://github.com/D-Programming-Language/druntime/commit/187cee5ca665e314de433649df2272d9e70880e2 Merge pull request #461 from rainers/fix_profile_treetime fix issue 9783: fix tree time when profiling recursive functions
Comment #2 by github-bugzilla — 2013-03-22T12:58:03Z