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

Chris Katko ckatko at
Sun Oct 3 08:31:14 UTC 2021

Does it break down on multi-threaded scenarios?

I'm running dmd (newest) + Allegro (a C game programming library) 
with DAllegro (a nice templated binder). My executable is 
multi-threaded (mostly just helper functions / glue logic from 
libraries/D/etc), and using OpenGL on 64-bit Linux with a very 
recent DMD release.

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.

It didn't make any sense, so I loaded it up with valgrind and 
kcachegrind and it said, "no, this function takes 0.00 of total 

Should I be using DMD's -profile? Does it have known failure 
modes? Is this failure mode new to people? Is there any way to 
get normal profiling with gprof or whatever with DMD, or do I 
need to compile with LDC and GDC?

I'm getting back into D and I recall having both toolchains (LDC 
and DMD) running. This might have been the reason I kept LDC 
around and maintained two sets of libraries compiled for both LDC 
and DMD.

Also "-profile" functions used over 7% of all CPU time. Is that 
the nature of the profiling, or is D using way more than 
comparable languages/compilers?

Lastly, is there any way to d mangle D functions in 

Thanks! Have a great weekend!

More information about the Digitalmars-d mailing list