Bug 14565 – dmd -profile produces garbled output for long-running CPU-intensive processes

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-10T05:38:00Z
Last change time
2017-07-19T17:41:34Z
Assigned to
nobody
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2015-05-10T05:38:40Z
Currently, the profiling harness generated by dmd -profile uses uint (32-bit) for counting the number of times a function gets called. For profiling the steady-state of long-running, CPU-intensive code, 32-bit counters are easily overflowed, causing the profile output to be useless because some counters may have wrapped around, thus distorting the output (counts, ordering of functions that consumed the most time, etc.). Furthermore, due to the reliance on the rdtsc instruction which counts CPU cycles, given the high clock frequency of modern CPU's, even with a 64-bit counter a moderately long-running process will overflow this counter, causing time measurements to wrap around and again producing garbled output. This makes dmd -profile useless in profiling long-running CPU-intensive processes, as there is no way to measure the steady state of the process before the output gets garbled by wrapped-around counters.
Comment #1 by bugzilla — 2015-05-10T07:28:06Z
Comment #2 by github-bugzilla — 2015-05-11T10:09:34Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/6ce3287415567e2c63eca8bb73b7252a5c4f4d1c fix Issue 14565 - dmd -profile produces garbled output for long-running CPU-intensive processes https://github.com/D-Programming-Language/druntime/commit/74e40962ed5d4563ae3e9e29a4b7ee758ae7d02b Merge pull request #1261 from WalterBright/fix14565 fix Issue 14565 - dmd -profile produces garbled output for long-runni…
Comment #3 by github-bugzilla — 2015-06-17T21:02:38Z
Commits pushed to stable at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/6ce3287415567e2c63eca8bb73b7252a5c4f4d1c fix Issue 14565 - dmd -profile produces garbled output for long-running CPU-intensive processes https://github.com/D-Programming-Language/druntime/commit/74e40962ed5d4563ae3e9e29a4b7ee758ae7d02b Merge pull request #1261 from WalterBright/fix14565
Comment #4 by github-bugzilla — 2017-07-19T17:41:34Z
Commits pushed to dmd-cxx at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/6ce3287415567e2c63eca8bb73b7252a5c4f4d1c fix Issue 14565 - dmd -profile produces garbled output for long-running CPU-intensive processes https://github.com/dlang/druntime/commit/74e40962ed5d4563ae3e9e29a4b7ee758ae7d02b Merge pull request #1261 from WalterBright/fix14565