Skip to content

callGraphsUMLdiagrams

holzkohlengrill edited this page Dec 15, 2023 · 2 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

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