Call graph generator for Julia


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

Something like this:


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.


@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.


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))

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


Clustering by file like in figure 21 is nice too