How accurate is dmd profile? (and do I need GMD/LDC to use gprof?)
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Oct 6 14:50:57 UTC 2021
On Wed, Oct 06, 2021 at 05:34:54AM +0000, Imperatorn via Digitalmars-d wrote:
> On Monday, 4 October 2021 at 06:10:00 UTC, bauss wrote:
> > On Sunday, 3 October 2021 at 21:55:29 UTC, H. S. Teoh wrote:
> > > 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.
> > What the... I had no idea but that alone deems it useless to me.
> Maybe we can change it
That would be very nice. I believe the code is somewhere in druntime.
It would save a lot of grief in the future. :-)
An elephant: A mouse built to government specifications. -- Robert Heinlein
More information about the Digitalmars-d