[Issue 14565] New: dmd -profile produces garbled output for long-running CPU-intensive processes
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat May 9 22:38:40 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14565
Issue ID: 14565
Summary: dmd -profile produces garbled output for long-running
CPU-intensive processes
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: hsteoh at quickfur.ath.cx
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.
--
More information about the Digitalmars-d-bugs
mailing list