summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-01-23 15:14:08 +0000
committerIan Lynagh <igloo@earth.li>2011-01-23 15:14:08 +0000
commiteb3a1aecac72d22c618b4050fb88eac9055b527a (patch)
treeb86df2bf98b480a27d41ae0a1938243c673c0225
parentdd47428295d89eb6bbf91316ac4f5a6e98b1ec70 (diff)
downloadhaskell-eb3a1aecac72d22c618b4050fb88eac9055b527a.tar.gz
Add build system profiling to build system
-rw-r--r--ghc.mk1
-rw-r--r--rules/build-dependencies.mk2
-rw-r--r--rules/build-package-data.mk2
-rw-r--r--rules/build-package-way.mk2
-rw-r--r--rules/build-package.mk2
-rw-r--r--rules/build-perl.mk2
-rw-r--r--rules/build-prog.mk2
-rw-r--r--rules/docbook.mk2
-rw-r--r--rules/haddock.mk2
-rw-r--r--rules/include-dependencies.mk2
-rw-r--r--rules/manual-package-config.mk2
-rw-r--r--rules/package-config.mk2
-rw-r--r--rules/prof.mk20
-rw-r--r--rules/shell-wrapper.mk2
-rw-r--r--rules/tags-package.mk2
15 files changed, 47 insertions, 0 deletions
diff --git a/ghc.mk b/ghc.mk
index 53b859da77..3ad7d45a99 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -139,6 +139,7 @@ endif
# -----------------------------------------------------------------------------
# Utility definitions
+include rules/prof.mk
include rules/trace.mk
include rules/make-command.mk
diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk
index fa4e2d2d8d..3aa176cf05 100644
--- a/rules/build-dependencies.mk
+++ b/rules/build-dependencies.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
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 98f66e61c1..3392d904d0 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -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
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index c2849ce95f..8b67ce2239 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -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
diff --git a/rules/build-package.mk b/rules/build-package.mk
index 3f4cd934a2..74ffbbd925 100644
--- a/rules/build-package.mk
+++ b/rules/build-package.mk
@@ -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
diff --git a/rules/build-perl.mk b/rules/build-perl.mk
index e13185d85d..301d84860c 100644
--- a/rules/build-perl.mk
+++ b/rules/build-perl.mk
@@ -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
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 4c07ad6308..c08c40828a 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -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
diff --git a/rules/docbook.mk b/rules/docbook.mk
index ebc37517be..8030fb7dc8 100644
--- a/rules/docbook.mk
+++ b/rules/docbook.mk
@@ -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
diff --git a/rules/haddock.mk b/rules/haddock.mk
index ae58bceda4..99e0df66a5 100644
--- a/rules/haddock.mk
+++ b/rules/haddock.mk
@@ -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
diff --git a/rules/include-dependencies.mk b/rules/include-dependencies.mk
index c6096f4274..b93311075f 100644
--- a/rules/include-dependencies.mk
+++ b/rules/include-dependencies.mk
@@ -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
diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk
index 6b2b2ac2cb..c37f204d95 100644
--- a/rules/manual-package-config.mk
+++ b/rules/manual-package-config.mk
@@ -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
diff --git a/rules/package-config.mk b/rules/package-config.mk
index f111e1efac..2091779d1e 100644
--- a/rules/package-config.mk
+++ b/rules/package-config.mk
@@ -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
diff --git a/rules/prof.mk b/rules/prof.mk
new file mode 100644
index 0000000000..c80a7c5312
--- /dev/null
+++ b/rules/prof.mk
@@ -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
+
diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk
index 6cd3cdb49d..64339576c6 100644
--- a/rules/shell-wrapper.mk
+++ b/rules/shell-wrapper.mk
@@ -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
diff --git a/rules/tags-package.mk b/rules/tags-package.mk
index e9116487fb..e72ffb74c1 100644
--- a/rules/tags-package.mk
+++ b/rules/tags-package.mk
@@ -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