www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14565] New: dmd -profile produces garbled output for


          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 puremagic.com
          Reporter: hsteoh 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.

May 09 2015