How accurate is dmd profile? (and do I need GMD/LDC to use gprof?)

bauss jj_1337 at
Mon Oct 4 06:10:00 UTC 2021

On Sunday, 3 October 2021 at 21:55:29 UTC, H. S. Teoh wrote:
> On Sun, Oct 03, 2021 at 08:31:14AM +0000, Chris Katko via 
> Digitalmars-d wrote: [...]
>> The function that dmd's -profile reported was the biggest user 
>> of CPU time was a tiny little function that draws a couple 
>> background tiles. (<30 at worst case) As opposed to everything 
>> else being drawn, tons of opengl primitives, graphical text, 
>> text being converted with tons of writelns to console, etc.
> [...]
> Be aware that dmd -profile uses *16-bit counters* for tracking 
> function call counts; if your program is CPU-intensive and 
> calls the same function(s) in inner loops more than 65535 
> times, the counters will wrap around and cause the profile 
> output to be garbled.
> I ran into this a couple of years ago when trying to profile 
> some CPU-intensive code with some non-trivial testcases, and 
> found dmd -profile output completely unusable because of this 
> limitation.
> T

What the... I had no idea but that alone deems it useless to me.

More information about the Digitalmars-d mailing list