Skip to content

callGraphsUMLdiagrams

Marcel Schmalzl edited this page Sep 16, 2024 · 3 revisions

Creating call graphs

Call graph

Installation

sudo apt-get install graphviz
pip3 install gprof2dot

Usage

Generate data using python3

python3 -m cProfile -o test.profile ./MAdZ.py
#                       ^^^^^^^       ^^^^^
#                     output file   input file (to be analysed)

Generate a .dot file from profiled data:

gprof2dot -f pstats test.profile -o callingGrpah.dot

Generate a .png with 300 dpi resolution (default = 96dpi) from our .dot-file using graphviz:

dot -Tpng -Gdpi=300 callingGrpah.dot > callingGrpah.png

We also want a .svg:

dot -Tsvg callingGrpah.dot > callingGrpah.svg

Creating UML class diagrams

Installation

pip3 install pylint                 # pyreverse is part of the pylint package
sudo apt install graphviz           # Needed for visualisation

Usage

pyreverse -ASmy -o png ./MAdZ.py -p MAdZ
#               ^^^^^    ^^^^^^    ^^^^
#        output format    |||       output filename ("classes" will be prepended)
#                    file to analyse

See also https://www.logilab.org/blogentry/6883

Clone this wiki locally