Thread overview
Call diagram generation
Jan 03, 2010
Strt
Jan 03, 2010
Lutger
Jan 05, 2010
strt@spam.com>
Jan 05, 2010
BCS
January 03, 2010
How can I generate some sort of call diagram from my D code?
January 03, 2010
On 01/03/2010 04:31 AM, Strt wrote:
> How can I generate some sort of call diagram from my D code?

you can compile with (dmd) -profile and run the executable. This produces a file called trace.log which contains timings for each function and a call graph. It doesn't produce a diagram and has mangled symbols though.

You can demangle with std.demangle, read the trace.log with descent or use this utility:
http://www.dsource.org/projects/scrapple/wiki/PtraceUtility

I haven't updated ptrace in quite a while, so I'm not sure if it still works.

January 05, 2010
Lutger Wrote:

> On 01/03/2010 04:31 AM, Strt wrote:
> > How can I generate some sort of call diagram from my D code?
> 
> you can compile with (dmd) -profile and run the executable. This produces a file called trace.log which contains timings for each function and a call graph. It doesn't produce a diagram and has mangled symbols though.
> 
> You can demangle with std.demangle, read the trace.log with descent or use this utility: http://www.dsource.org/projects/scrapple/wiki/PtraceUtility
> 
> I haven't updated ptrace in quite a while, so I'm not sure if it still works.
> 

I just noticed it is called a call graph, being directed and all.
I really just needed the visual thing and seeing that I need to get tango to work to use ptrace (and then maybe it won't work) I really should just take pencil and paper, I think. Also, it is only a sub-section (30 functions or so)  I'm interested in.
Thanks anyway!

January 05, 2010
Hello Strt,

> Lutger Wrote:
> 
>> On 01/03/2010 04:31 AM, Strt wrote:
>> 
>>> How can I generate some sort of call diagram from my D code?
>>> 
>> you can compile with (dmd) -profile and run the executable. This
>> produces a file called trace.log which contains timings for each
>> function and a call graph. It doesn't produce a diagram and has
>> mangled symbols though.
>> 
>> You can demangle with std.demangle, read the trace.log with descent
>> or use this utility:
>> http://www.dsource.org/projects/scrapple/wiki/PtraceUtility
>> 
>> I haven't updated ptrace in quite a while, so I'm not sure if it
>> still works.
>> 
> I just noticed it is called a call graph, being directed and all.
> 
> I really just needed the visual thing and seeing that I need to get
> tango to work to use ptrace (and then maybe it won't work) I really
> should just take pencil and paper, I think. Also, it is only a
> sub-section (30 functions or so)  I'm interested in.
> 
> Thanks anyway!
> 

With a little persitance, I'd bet that you could make a awk/grep/sed system that would convert that output to a graphviz file. With a little fun using pragma(msg,...) and .mangleof you could even get demangled symbols.