Permalink
Browse files

Add build system profiling to build system

  • Loading branch information...
1 parent dd47428 commit eb3a1aecac72d22c618b4050fb88eac9055b527a @igfoo igfoo committed Jan 23, 2011
View
1 ghc.mk
@@ -139,6 +139,7 @@ endif
# -----------------------------------------------------------------------------
# Utility definitions
+include rules/prof.mk
include rules/trace.mk
include rules/make-command.mk
@@ -12,6 +12,7 @@
define build-dependencies
$(call trace, build-dependencies($1,$2,$3))
+$(call profStart, build-dependencies($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
@@ -73,6 +74,7 @@ endif # $1_$2_NO_BUILD_DEPS
# Note sed magic above: mkdependC can't do -odir stuff, so we have to
# munge the dependencies it generates to refer to the correct targets.
+$(call profEnd, build-dependencies($1,$2,$3))
endef
# This comment is outside the "define addCFileDeps" as that definition
@@ -12,6 +12,7 @@
define build-package-data
$(call trace, build-package-data($1,$2,$3))
+$(call profStart, build-package-data($1,$2,$3))
# args:
# $1 = dir
# $2 = distdir
@@ -80,4 +81,5 @@ endif
PACKAGE_DATA_MKS += $1/$2/package-data.mk
+$(call profEnd, build-package-data($1,$2,$3))
endef
@@ -13,6 +13,7 @@
define build-package-way # $1 = dir, $2 = distdir, $3 = way, $4 = stage
$(call trace, build-package-way($1,$2,$3))
+$(call profStart, build-package-way($1,$2,$3))
$(call distdir-way-opts,$1,$2,$3,$4)
$(call hs-suffix-rules,$1,$2,$3)
@@ -130,5 +131,6 @@ endif
endif
endif
+$(call profEnd, build-package-way($1,$2,$3))
endef
View
@@ -30,6 +30,7 @@
define build-package
$(call trace, build-package($1,$2,$3))
+$(call profStart, build-package($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
@@ -52,6 +53,7 @@ clean_$1_$2_config:
ifneq "$$($1_$2_NOT_NEEDED)" "YES"
$$(eval $$(call build-package-helper,$1,$2,$3))
endif
+$(call profEnd, build-package($1,$2,$3))
endef
View
@@ -20,6 +20,7 @@
define build-perl
$(call trace, build-perl($1,$2))
+$(call profStart, build-perl($1,$2))
# $1 = dir
# $2 = distdir
@@ -65,4 +66,5 @@ install_$1_$2: $1/$2/$$($1_$2_PROG)
endif
endif
+$(call profEnd, build-perl($1,$2))
endef
View
@@ -21,6 +21,7 @@
define build-prog
$(call trace, build-prog($1,$2,$3))
+$(call profStart, build-prog($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
@@ -40,6 +41,7 @@ $(call clean-target,$1,$2,$1/$2)
ifneq "$$($1_$2_NOT_NEEDED)" "YES"
$$(eval $$(call build-prog-helper,$1,$2,$3))
endif
+$(call profEnd, build-prog($1,$2,$3))
endef
View
@@ -15,6 +15,7 @@
define docbook
$(call trace, docbook($1,$2))
+$(call profStart, docbook($1,$2))
# $1 = dir
# $2 = docname
@@ -80,5 +81,6 @@ $1/$2.pdf: $$($1_DOCBOOK_SOURCES)
[ -f $$@ ]
endif
+$(call profEnd, docbook($1,$2))
endef
View
@@ -13,6 +13,7 @@
define haddock # args: $1 = dir, $2 = distdir
$(call trace, haddock($1,$2))
+$(call profStart, haddock($1,$2))
ifneq "$$($1_$2_DO_HADDOCK)" "NO"
@@ -71,5 +72,6 @@ endif
endif
+$(call profEnd, haddock($1,$2))
endef
@@ -12,6 +12,7 @@
define include-dependencies
$(call trace, include-dependencies($1,$2,$3))
+$(call profStart, include-dependencies($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
@@ -29,5 +30,6 @@ $$(warning not building dependencies in $1)
endif
endif
+$(call profEnd, include-dependencies($1,$2,$3))
endef
@@ -13,6 +13,7 @@
define manual-package-config # args: $1 = dir
$(call trace, manual-package-config($1))
+$(call profStart, manual-package-config($1))
$1/package.conf.inplace : $1/package.conf.in $(GHC_PKG_INPLACE)
$$(CPP) $$(RAWCPP_FLAGS) -P \
@@ -42,4 +43,5 @@ distclean : clean_$1_package.conf
clean_$1_package.conf :
"$$(RM)" $$(RM_OPTS) $1/package.conf.install $1/package.conf.inplace
+$(call profEnd, manual-package-config($1))
endef
View
@@ -13,6 +13,7 @@
define package-config # args: $1 = dir, $2 = distdir, $3 = GHC stage
$(call trace, package-config($1,$2,$3))
+$(call profStart, package-config($1,$2,$3))
$1_$2_HC = $$(GHC_STAGE$3)
@@ -55,4 +56,5 @@ endif
# Useful later
$1_$2_SLASH_MODS = $$(subst .,/,$$($1_$2_MODULES))
+$(call profEnd, package-config($1,$2,$3))
endef
View
@@ -0,0 +1,20 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2010 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
+define profStart
+$$(if $(PROF),$$(info $$(shell date +%s.%N): Start $1))
+endef
+
+define profEnd
+$$(if $(PROF),$$(info $$(shell date +%s.%N): End $1))
+endef
+
View
@@ -12,6 +12,7 @@
define shell-wrapper
$(call trace, shell-wrapper($1,$2))
+$(call profStart, shell-wrapper($1,$2))
# $1 = dir
# $2 = distdir
@@ -85,4 +86,5 @@ endif
endif # $1_$2_SHELL_WRAPPER
+$(call profEnd, shell-wrapper($1,$2))
endef
View
@@ -19,6 +19,7 @@
define tags-package
$(call trace, tags-package($1,$2))
+$(call profStart, tags-package($1,$2))
# $1 = dir
# $2 = distdir
@@ -30,5 +31,6 @@ tags_$1:
TAGS_$1:
inplace/bin/ghctags --topdir $$(TOP)/inplace/lib -e --use-cabal-config $1/$2 -- $$($1_$2_TAGS_HC_OPTS) $$($1_$2_v_ALL_HC_OPTS) -- $$($1_$2_HS_SRCS)
+$(call profEnd, tags-package($1,$2))
endef

0 comments on commit eb3a1ae

Please sign in to comment.