Skip to content

Commit

Permalink
python: add graphviz callgraphs
Browse files Browse the repository at this point in the history
Uses the JSON data extracted from LLVM bitcode by tools/frr-llvm-cg.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
  • Loading branch information
eqvinox committed May 5, 2020
1 parent 8fb4037 commit 3d62176
Show file tree
Hide file tree
Showing 3 changed files with 488 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
*_clippy.c
*.bc
*.cg.json
*.cg.dot
*.cg.svg

### gcov outputs

Expand Down
11 changes: 10 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,15 @@ SUFFIXES += .lo.bc .o.bc

%.cg.json: %.bc tools/frr-llvm-cg
tools/frr-llvm-cg -o $@ $<
%.cg.dot: %.cg.json
$(PYTHON) $(top_srcdir)/python/callgraph-dot.py $< $@
%.cg.svg: %.cg.dot
@echo if the following command fails, you need to install graphviz.
@echo also, the output is nondeterministic. run it multiple times and use the nicest output.
@echo tuning parameters may yield nicer looking graphs as well.
fdp -GK=0.7 -Gstart=42231337 -Gmaxiter=2000 -Elen=2 -Gnodesep=1.5 -Tsvg -o$@ $<
# don't delete intermediaries
.PRECIOUS: %.cg.json %.cg.dot

# <lib>.la.bc, <lib>.a.bc and <daemon>.bc targets are generated by
# python/makefile.py
Expand All @@ -264,7 +273,7 @@ clean-python:
find . -name "*.pyc" -o -name "*_clippy.c" | xargs rm -f

clean-llvm-bitcode:
find . -name "*.bc" -o -name "*.cg.json" | xargs rm -f
find . -name "*.bc" -o -name "*.cg.json" -o -name "*.cg.dot" -o -name "*.cg.svg" | xargs rm -f

redistclean:
$(MAKE) distclean CONFIG_CLEAN_FILES="$(filter-out $(EXTRA_DIST), $(CONFIG_CLEAN_FILES))"
Expand Down
Loading

0 comments on commit 3d62176

Please sign in to comment.