Converts the transitive dependencies of a gradle java project into a flame graph. Allows to see the cumulated and relative size of all dependencies.
The stackcollapse-gradle-dependencies.pl
script takes the output of
gradle dependencies
and converts it to a format accepted by flamegraph.pl
The deps-flamegraph
bash script takes care of everything. Just run it
from any gradle java project.
See included example that computes the dependencies of Cassandra.
The file was generated by running ../../deps-flamegraph
under samples/cassandra
.
$ ../../deps-flamegraph
Could not find flamegraph.pl, getting it from GitHub
Cloning into 'FlameGraph'...
Computing cassandra runtime dependencies.
NB: Set CONFIGURATION=compile (or testRuntime etc.) for other configurations.
Generated deps-runtime.svg
NB: the SVG is interactive but this does not work in GitHub (clone the project to see for yourself).
Here are the options of the perl script, they can be used also with the deps-flamegraph
script.
USAGE: stackcollapse-gradle-dependencies.pl [options] infile > outfile
--org # include dependency organisation in label
--version # include dependency version in label
--no-size # ignore jar size (all deps have equal weight)
--no-dups # count deps only once (allows to more accurately aggregate size)
--jar-cache DIR # specify alternate path for gradle jar cache
To generate test dependencies, run the following command:
CONFIGURATION=testRuntime deps-flamegraph
If your goal is to estimate the total weight of your dependencies, use the --no-dups
option to avoid counting deps several times when there are several different paths that
link to them.