Debugging

Graham St Jack graham.stjack at internode.on.net
Sat Jul 17 16:11:59 PDT 2010


On Sat, 17 Jul 2010 14:43:38 -0400, Sean Kelly wrote:

> Graham St Jack Wrote:
> 
>> On Fri, 16 Jul 2010 21:47:50 +0000, Sean Kelly wrote:
>> 
>> > -profile currently doesn't work with multithreaded apps.
>> 
>> Darn. Are there plans to sort that out?
> 
> It's been on my "to do" list for ages.  Timing data is less/differently
> useful for multithreaded code, but it should at least not crash, unlike
> now.

I find profiling very useful in multi-threaded programs for assisting 
with optimisation, and am keen for it to be possible.

I use C++ in my day job (with gcc), and recently went through a lot of 
pain trying to get gprof to work, only to discover that it fundamentally 
doesn't work on multi-threaded code. I guess that is fair enough given 
that instrumented code can't use something as simple as a high-resolution 
clock to measure how long things take.

What I ended up using was sysprof, which is an external program that does 
statistical sampling of the whole system. It works really well, and 
produces a respectable call graph that shows very clearly where the time 
is being spent. However, when I try it with a D2 program, I don't get a 
call graph - presumably because it doesn't understand the stack frames 
and so can't work out the call graph. This renders it almost useless for 
D programs.


More information about the Digitalmars-d mailing list