Skip to content

Instantly share code, notes, and snippets.

@vprusa
Created November 4, 2019 17:11
Show Gist options
  • Save vprusa/0fa647248de55a12d88d8028fb0d12a0 to your computer and use it in GitHub Desktop.
Save vprusa/0fa647248de55a12d88d8028fb0d12a0 to your computer and use it in GitHub Desktop.
pv021 callgraph on existing project
#!/bin/bash
# using https://github.com/gousiosg/java-callgraph
# basic static on https://github.com/university-studies/neural-networks-pv021
java -jar ./target/javacg-0.1-SNAPSHOT-static.jar ./neural-networks-forecast-1.0-SNAPSHOT.jar > callgraph.txt
sed -i '/CliArgumentsParser/d' ./callgraph.txt
sed -i '/TestUtils/d' ./callgraph.txt
sed -i '/OHLC/d' ./callgraph.txt
sed -i 's/cz.muni.neural.network.//g' ./callgraph.txt
#sed -i '/double/d' ./callgraph.txt
#sed -i '/int/d' ./callgraph.txt
#sed -i '/List/d' ./callgraph.txt
#sed -i '/Object/d' ./callgraph.txt
sed -i '/java/d' ./callgraph.txt
sort ./callgraph.txt | uniq -d > ./callgraph2.txt
mv callgraph2.txt callgraph.txt
OUT=callgraph.dot
echo "graph test {" > $OUT
sed -e 's/[a-z]+\.//g;' -e 's/ / -- /;' -e 's/[\$|\:]/_/g' -e 's/\.//g' -e 's/(//g' -e 's/)//g' -e 's/\[//g' -e 's/\]//g' -e 's/[0-9]*//g' callgraph.txt >> $OUT
echo "}" >> $OUT
dot -Tpng callgraph.dot -o callgraph.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment