diff options
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RetainerProfile.c | 19 | ||||
-rw-r--r-- | rts/RetainerSet.c | 23 | ||||
-rw-r--r-- | rts/RetainerSet.h | 29 |
3 files changed, 2 insertions, 69 deletions
diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 32d93c800a..d2329c45fb 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -1038,9 +1038,7 @@ initRetainerProfiling( void ) void endRetainerProfiling( void ) { -#if defined(SECOND_APPROACH) outputAllRetainerSet(prof_file); -#endif } /* ----------------------------------------------------------------------------- @@ -1191,14 +1189,6 @@ isRetainer( StgClosure *c ) * This function does NOT return the retainer(s) of *c. * Invariants: * *c must be a retainer. - * Note: - * Depending on the definition of this function, the maintenance of retainer - * sets can be made easier. If most retainer sets are likely to be created - * again across garbage collections, refreshAllRetainerSet() in - * RetainerSet.c can simply do nothing. - * If this is not the case, we can free all the retainer sets and - * re-initialize the hash table. - * See refreshAllRetainerSet() in RetainerSet.c. * -------------------------------------------------------------------------- */ static INLINE retainer getRetainerFrom( StgClosure *c ) @@ -1996,11 +1986,7 @@ retainerProfile(void) retainer sets. */ initializeTraverseStack(&g_retainerTraverseState); -#if defined(DEBUG_RETAINER) initializeAllRetainerSet(); -#else - refreshAllRetainerSet(); -#endif computeRetainerSet(&g_retainerTraverseState); #if defined(DEBUG_RETAINER) @@ -2044,11 +2030,6 @@ retainerProfile(void) // post-processing closeTraverseStack(&g_retainerTraverseState); -#if defined(DEBUG_RETAINER) - closeAllRetainerSet(); -#else - // Note that there is no post-processing for the retainer sets. -#endif retainerGeneration++; stat_endRP( diff --git a/rts/RetainerSet.c b/rts/RetainerSet.c index 634035b0d0..98cfcec225 100644 --- a/rts/RetainerSet.c +++ b/rts/RetainerSet.c @@ -74,25 +74,6 @@ initializeAllRetainerSet(void) } /* ----------------------------------------------------------------------------- - * Refreshes all pools for reuse and initializes hashTable[]. - * -------------------------------------------------------------------------- */ -void -refreshAllRetainerSet(void) -{ -#if defined(FIRST_APPROACH) - int i; - - // first approach: completely refresh - arenaFree(arena); - arena = newArena(); - - for (i = 0; i < HASH_TABLE_SIZE; i++) - hashTable[i] = NULL; - nextId = 2; -#endif /* FIRST_APPROACH */ -} - -/* ----------------------------------------------------------------------------- * Frees all pools. * -------------------------------------------------------------------------- */ void @@ -229,7 +210,6 @@ printRetainer(FILE *f, retainer ccs) * printRetainerSetShort() should always display the same output for * a given retainer set regardless of the time of invocation. * -------------------------------------------------------------------------- */ -#if defined(SECOND_APPROACH) void printRetainerSetShort(FILE *f, RetainerSet *rs, W_ total_size, uint32_t max_length) { @@ -265,14 +245,12 @@ printRetainerSetShort(FILE *f, RetainerSet *rs, W_ total_size, uint32_t max_leng fputs(tmp, f); traceHeapProfSampleString(0, tmp, total_size); } -#endif /* SECOND_APPROACH */ /* ----------------------------------------------------------------------------- * Dump the contents of each retainer set into the log file at the end * of the run, so the user can find out for a given retainer set ID * the full contents of that set. * -------------------------------------------------------------------------- */ -#if defined(SECOND_APPROACH) void outputAllRetainerSet(FILE *prof_file) { @@ -333,6 +311,5 @@ outputAllRetainerSet(FILE *prof_file) stgFree(rsArray); } -#endif /* SECOND_APPROACH */ #endif /* PROFILING */ diff --git a/rts/RetainerSet.h b/rts/RetainerSet.h index 44ec519c68..aa5f44beaa 100644 --- a/rts/RetainerSet.h +++ b/rts/RetainerSet.h @@ -52,31 +52,10 @@ typedef struct _RetainerSet { // do not put anything below here! } RetainerSet; -/* - Note: - There are two ways of maintaining all retainer sets. The first is simply by - freeing all the retainer sets and re-initialize the hash table at each - retainer profiling. The second is by setting the cost field of each - retainer set. The second is preferred to the first if most retainer sets - are likely to be observed again during the next retainer profiling. Note - that in the first approach, we do not free the memory allocated for - retainer sets; we just invalidate all retainer sets. - */ -#if defined(DEBUG_RETAINER) -// In thise case, FIRST_APPROACH must be turned on because the memory pool -// for retainer sets is freed each time. -#define FIRST_APPROACH -#else -// #define FIRST_APPROACH -#define SECOND_APPROACH -#endif // Creates the first pool and initializes a hash table. Frees all pools if any. void initializeAllRetainerSet(void); -// Refreshes all pools for reuse and initializes a hash table. -void refreshAllRetainerSet(void); - // Frees all pools. void closeAllRetainerSet(void); @@ -138,25 +117,21 @@ isMember(retainer r, RetainerSet *rs) // Finds or creates a retainer set augmented with a new retainer. RetainerSet *addElement(retainer, RetainerSet *); -#if defined(SECOND_APPROACH) // Prints a single retainer set. void printRetainerSetShort(FILE *, RetainerSet *, W_, uint32_t); -#endif // Print the statistics on all the retainer sets. // store the sum of all costs and the number of all retainer sets. void outputRetainerSet(FILE *, uint32_t *, uint32_t *); -#if defined(SECOND_APPROACH) // Print all retainer sets at the exit of the program. void outputAllRetainerSet(FILE *); -#endif // Hashing functions /* Invariants: - Once either initializeAllRetainerSet() or refreshAllRetainerSet() - is called, there exists only one copy of any retainer set created + Once initializeAllRetainerSet() is called, + there exists only one copy of any retainer set created through singleton() and addElement(). The pool (the storage for retainer sets) is consumed linearly. All the retainer sets of the same hash function value are linked together from an element in |