summaryrefslogtreecommitdiff
path: root/rts/RtsStartup.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2007-04-27 12:01:13 +0000
committerSimon Marlow <simonmar@microsoft.com>2007-04-27 12:01:13 +0000
commitcbeb99efd4a117de5b028341dc41bc8f50717383 (patch)
tree718b3dab5c48e29f797210702cbc2dc4d2b732ea /rts/RtsStartup.c
parent47e0b5e52240f8794b117e0dbde4e21f41ffe9ec (diff)
downloadhaskell-cbeb99efd4a117de5b028341dc41bc8f50717383.tar.gz
Basic heap profile support without -prof
Now that constructor info tables contain the name of the constructor, we can generate useful heap profiles without requiring the whole program and libraries to be compiled with -prof. So now, "+RTS -hT" generates a heap profile for any program, dividing the profile by constructor. It wouldn't be hard to add support for grouping constructors by module, or to restrict the profile to certain constructors/modules/packages. This means that for the first time we can get heap profiles for GHCi, which was previously impossible because the byte-code interpreter and linker don't work with -prof.
Diffstat (limited to 'rts/RtsStartup.c')
-rw-r--r--rts/RtsStartup.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 85b1c020fb..1d0fec5dd7 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -38,8 +38,9 @@
#include "FrontPanel.h"
#endif
-#if defined(PROFILING) || defined(DEBUG)
# include "Profiling.h"
+
+#if defined(PROFILING)
# include "ProfHeap.h"
# include "RetainerProfile.h"
#endif
@@ -244,9 +245,7 @@ hs_init(int *argc, char **argv[])
initThreadLabelTable();
#endif
-#if defined(PROFILING) || defined(DEBUG)
initProfiling1();
-#endif
/* start the virtual timer 'subsystem'. */
startTimer();
@@ -353,11 +352,9 @@ hs_add_root(void (*init_root)(void))
startupHpc();
-#if defined(PROFILING) || defined(DEBUG)
// This must be done after module initialisation.
// ToDo: make this work in the presence of multiple hs_add_root()s.
initProfiling2();
-#endif
}
/* -----------------------------------------------------------------------------
@@ -455,9 +452,7 @@ hs_exit(void)
/* free the stable pointer table */
exitStablePtrTable();
-#if defined(PROFILING) || defined(DEBUG)
freeProfiling1();
-#endif
#if defined(DEBUG)
/* free the thread label table */
@@ -477,9 +472,7 @@ hs_exit(void)
reportCCSProfiling();
#endif
-#if defined(PROFILING) || defined(DEBUG)
endProfiling();
-#endif
#ifdef PROFILING
// Originally, this was in report_ccs_profiling(). Now, retainer