From 9e612ad41b3231db504079c6e13fdd8951f3c695 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Thu, 26 Jan 2006 09:38:01 +0000 Subject: [PATCH] added generation of KLOCs in dot diagrams --- helm/ocaml/Makefile.common.in | 10 ++++++++++ helm/ocaml/Makefile.in | 6 ++++++ helm/ocaml/daemons.dot | 12 ++++++------ helm/ocaml/deps.patch | 20 ++++++++++++++++---- helm/ocaml/patch_deps.sh | 23 ++++++++++++++++++++++- helm/ocaml/tactics/Makefile | 2 ++ helm/ocaml/utf8_macros/Makefile | 2 ++ 7 files changed, 64 insertions(+), 11 deletions(-) diff --git a/helm/ocaml/Makefile.common.in b/helm/ocaml/Makefile.common.in index ef569ff80..9dff78942 100644 --- a/helm/ocaml/Makefile.common.in +++ b/helm/ocaml/Makefile.common.in @@ -104,6 +104,16 @@ ocamlinit: for p in $(REQUIRES); do echo "#require \"$$p\";;" >> .ocamlinit; done echo "#load \"$(PACKAGE).cma\";;" >> .ocamlinit +# $(STATS_EXCLUDE) may be defined in libraries' Makefile to exclude some file +# from statistics collection +STATS_FILES = \ + $(shell find . -maxdepth 1 -type f -name \*.ml $(foreach f,$(STATS_EXCLUDE),-not -name $(f))) \ + $(shell find . -maxdepth 1 -type f -name \*.mli $(foreach f,$(STATS_EXCLUDE),-not -name $(f))) +.stats: $(STATS_FILES) + rm -f .stats + echo -n "LOC:" >> .stats + wc -l $(STATS_FILES) | tail -1 | awk '{ print $$1 }' >> .stats + .PHONY: all opt world backup depend install uninstall clean ocamlinit ifneq ($(MAKECMDGOALS), depend) diff --git a/helm/ocaml/Makefile.in b/helm/ocaml/Makefile.in index 31744803e..66a0ae74a 100644 --- a/helm/ocaml/Makefile.in +++ b/helm/ocaml/Makefile.in @@ -45,6 +45,10 @@ install: $(MODULES:%=%.install) uninstall: $(MODULES:%=%.uninstall) clean: $(MODULES:%=%.clean) +.stats: $(MODULES:%=%.stats) + (for m in $(MODULES); do echo -n "$$m:"; cat $$m/.stats; done) \ + | sort -t : -k 2 -n -r > .stats + clean_metas: rm -f $(METAS) distclean: clean clean_metas @@ -60,6 +64,8 @@ distclean: clean clean_metas OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH $(MAKE) -C $* clean %.depend: OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH $(MAKE) -C $* depend +%.stats: + $(MAKE) -C $* .stats $(MODULES:%=%.install): cd $(@:%.install=%) && make install diff --git a/helm/ocaml/daemons.dot b/helm/ocaml/daemons.dot index 93c122d8a..4a8ba388f 100644 --- a/helm/ocaml/daemons.dot +++ b/helm/ocaml/daemons.dot @@ -1,12 +1,12 @@ /* apps */ subgraph applications { node [shape=plaintext,style=filled,fillcolor=slategray2]; - DependencyAnalyzer [label="Dependency\nAnalyzer"]; - Getter; - Matita; - ProofChecker [label="Proof\nChecker"]; - Uwobo; - Whelp; + DependencyAnalyzer [label="Dependency\nAnalyzer\n .3 klocs"]; + Getter [label="Getter\n .3 klocs"]; + Matita [label="Matita\n 6.7 klocs"]; + ProofChecker [label="Proof Checker\n .1 klocs"]; + Uwobo [label="Uwobo\n 2.1 klocs"]; + Whelp [label="Whelp\n .6 klocs"]; } /* apps dep */ DependencyAnalyzer -> metadata; diff --git a/helm/ocaml/deps.patch b/helm/ocaml/deps.patch index d7f9cf8c9..90130dfe8 100644 --- a/helm/ocaml/deps.patch +++ b/helm/ocaml/deps.patch @@ -1,11 +1,23 @@ ---- .dep.dot 2005-12-19 12:07:15.000000000 +0100 -+++ .dep.dot.new 2005-12-19 12:08:10.000000000 +0100 -@@ -14,7 +14,7 @@ +--- .clustersdep.dot 2006-01-26 10:10:46.000000000 +0100 ++++ .clustersdep.new 2006-01-26 10:10:44.000000000 +0100 +@@ -1,11 +1,8 @@ + digraph G { + xml [label="xml\n.5 klocs"]; +- xmldiff [label="xmldiff\n.3 klocs"]; + whelp [label="whelp\n.3 klocs"]; + utf8_macros [label="utf8_macros\n.2 klocs"]; + urimanager [label="urimanager\n.2 klocs"]; +- thread [label="thread\n.2 klocs"]; +- paramodulation [label="paramodulation\n5.9 klocs"]; + tactics [label="tactics\n10.0 klocs"]; + registry [label="registry\n.6 klocs"]; + metadata [label="metadata\n1.9 klocs"]; +@@ -42,7 +39,7 @@ "cic_unification" -> "library"; "library" -> "metadata"; "library" -> "cic_acic"; -"metadata" -> "cic_proof_checking"; +"metadata" -> "cic"; "metadata" -> "hmysql"; - "grafite" -> "content_pres"; + "grafite" -> "cic"; "content_pres" -> "utf8_macros"; diff --git a/helm/ocaml/patch_deps.sh b/helm/ocaml/patch_deps.sh index cd9f09c89..dbdd27c11 100755 --- a/helm/ocaml/patch_deps.sh +++ b/helm/ocaml/patch_deps.sh @@ -10,10 +10,30 @@ fi # file will be modified in place include_dot_snippet () { - echo "Adding to $1 graphviz snipet $2 ..." + echo "Adding to $1 graphviz snippet $2 ..." sed -i "/digraph/r $2" $1 } +# args: stats file +# file will be modified in place +include_loc_stats () +{ + echo "Adding to $1 KLOCs stats from $2 ..." + tmp=`mktemp tmp.stats.XXXXXX` + for l in `cat $2`; do + module=$(basename $(echo $l | cut -d : -f 1)) + stat=$(echo $l | cut -d : -f 2) + if [ "$stat" = "LOC" ]; then + locs=$(echo $l | cut -d : -f 3) + klocs=$(echo "scale=1; $locs / 1000" | bc) + if [ "$klocs" = "0" ]; then klocs=".1"; fi + printf ' %s [label="%s\\n%s klocs"];\n' $module $module $klocs >> $tmp + fi + done + include_dot_snippet $1 $tmp + rm $tmp +} + # args: file patch apply_patch () { @@ -24,6 +44,7 @@ apply_patch () } cp $1 $2 +include_loc_stats $2 .stats apply_patch $2 deps.patch include_dot_snippet $2 daemons.dot if [ "$use_clusters" = "yes" ]; then diff --git a/helm/ocaml/tactics/Makefile b/helm/ocaml/tactics/Makefile index 57937414c..a39d01930 100644 --- a/helm/ocaml/tactics/Makefile +++ b/helm/ocaml/tactics/Makefile @@ -26,6 +26,8 @@ tactics.mli: tactics.ml *Tactics.mli *Tactic.mli fourierR.mli ring.mli paramodul echo "(* GENERATED FILE, DO NOT EDIT *)" > $@ $(OCAMLC) -I paramodulation -i $< >> $@ +STATS_EXCLUDE = tactics.mli + include ../Makefile.common OCAMLOPTIONS+= -I paramodulation diff --git a/helm/ocaml/utf8_macros/Makefile b/helm/ocaml/utf8_macros/Makefile index e3afd40f6..018f58cef 100644 --- a/helm/ocaml/utf8_macros/Makefile +++ b/helm/ocaml/utf8_macros/Makefile @@ -32,5 +32,7 @@ distclean: extra_clean extra_clean: rm -f make_table test +STATS_EXCLUDE = utf8MacroTable.ml + include ../Makefile.common -- 2.39.2