diff options
Diffstat (limited to 'rts/Profiling.c')
-rw-r--r-- | rts/Profiling.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/rts/Profiling.c b/rts/Profiling.c index 23a48993fd..982b9461a0 100644 --- a/rts/Profiling.c +++ b/rts/Profiling.c @@ -142,8 +142,7 @@ static void initProfilingLogFile ( void ); Initialise the profiling environment -------------------------------------------------------------------------- */ -void -initProfiling1 (void) +void initProfiling (void) { // initialise our arena prof_arena = newArena(); @@ -159,18 +158,6 @@ initProfiling1 (void) #ifdef THREADED_RTS initMutex(&ccs_mutex); #endif -} - -void -freeProfiling (void) -{ - arenaFree(prof_arena); -} - -void -initProfiling2 (void) -{ - CostCentreStack *ccs, *next; /* Set up the log file, and dump the header and cost centre * information into it. @@ -205,14 +192,7 @@ initProfiling2 (void) CCS_MAIN->root = CCS_MAIN; ccsSetSelected(CCS_MAIN); - // make CCS_MAIN the parent of all the pre-defined CCSs. - for (ccs = CCS_LIST; ccs != NULL; ) { - next = ccs->prevStack; - ccs->prevStack = NULL; - actualPush_(CCS_MAIN,ccs->cc,ccs); - ccs->root = ccs; - ccs = next; - } + initProfiling2(); if (RtsFlags.CcFlags.doCostCentres) { initTimeProfiling(); @@ -223,6 +203,29 @@ initProfiling2 (void) } } +// +// Should be called after loading any new Haskell code. +// +void initProfiling2 (void) +{ + CostCentreStack *ccs, *next; + + // make CCS_MAIN the parent of all the pre-defined CCSs. + for (ccs = CCS_LIST; ccs != NULL; ) { + next = ccs->prevStack; + ccs->prevStack = NULL; + actualPush_(CCS_MAIN,ccs->cc,ccs); + ccs->root = ccs; + ccs = next; + } + CCS_LIST = NULL; +} + +void +freeProfiling (void) +{ + arenaFree(prof_arena); +} static void initProfilingLogFile(void) |