Call graph generator for Julia


#1

Is there a tool for generating call graph from Julia source code files?

Something like this:


#2

Currently, there’s @cstjean’s TraceCalls.jl. In the not-too-distant future, Cassette.jl (or some package based on it) will likely address some (all?) of the known limitations of TraceCalls.


#3

@mkborregaard is working on generating call graphs from TraceCalls.jl traces, but AFAIK it’s not ready yet.

My plan is to rewrite the TraceCalls.jl backend to use Cassette.jl instead of Revise.jl once it’s ready. It remains to be seen what the tradeoffs between the two approaches are.


#4

Yeah, I’m still working out the details how to show it as clearly as possible, and would appreciate feedback over on the issue. Here’s a gist generating my favourite representation at the moment, a call tree:

In this representation, I duplicate a method call if it is called several times. I also have a working implementation of a call graph where each function only appears once (there is a working basic recipe on the TraceCalls issue), but to me this currently gives the results I like best.

Use like, e.g.

using TraceGraphs

using Plots, PlotRecipes
x = randn(10000)
trace = @trace Plots histogram(x);

pyplot(size = (2400, 3600))
plot(trace)

(click and download to view - plot calls are complex).


#5

Clustering by file like in figure 21 is nice too