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))
plot(trace)
(click and download to view - plot calls are complex).
Once TraceCalls.jl got deprecated, do you know of any package that could do it with Julia 1.7 onwards ?
@pfitzseb wrote something based on JuliaInterpreter (or was it Cassette?) at some point.
doesn’t have any nice printing and isn’t hooked up to Plots. Shouldn’t be too hard to do though. Note that this can end up being way too slow for bigger code bases.