/* -----------------------------------------------------------------------------
- * $Id: Printer.c,v 1.48 2001/11/20 16:17:23 simonmar Exp $
+ * $Id: Printer.c,v 1.49 2001/11/28 15:43:23 simonmar Exp $
*
* (c) The GHC Team, 1994-2000.
*
static void enZcode ( char *in, char *out );
#endif
static char unZcode ( char ch );
-rtsBool lookupGHCName ( StgPtr addr, const char **result );
+const char * lookupGHCName ( void *addr );
static void printZcoded ( const char *raw );
/* --------------------------------------------------------------------------
void printPtr( StgPtr p )
{
const char *raw;
- if (lookupGHCName( p, &raw )) {
+ raw = lookupGHCName(p);
+ if (raw != NULL) {
printZcoded(raw);
} else {
fprintf(stdout, "%p", p);
}
#endif
-rtsBool lookupGHCName( StgPtr addr, const char **result )
+const char *lookupGHCName( void *addr )
{
nat i;
for( i = 0; i < table_size && table[i].value != (unsigned) addr; ++i ) {
}
if (i < table_size) {
- *result = table[i].name;
- return rtsTrue;
+ return table[i].name;
} else {
- return rtsFalse;
+ return NULL;
}
}
/* -----------------------------------------------------------------------------
- * $Id: Printer.h,v 1.5 2000/01/14 14:56:40 simonmar Exp $
+ * $Id: Printer.h,v 1.6 2001/11/28 15:43:23 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
extern void DEBUG_LoadSymbols( char *name );
-extern rtsBool lookupGHCName( StgPtr addr, const char **result );
+extern const char *lookupGHCName( void *addr );
#endif
/* -----------------------------------------------------------------------------
- * $Id: ProfHeap.c,v 1.29 2001/11/28 15:01:02 simonmar Exp $
+ * $Id: ProfHeap.c,v 1.30 2001/11/28 15:43:23 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
#include "RetainerProfile.h"
#include "LdvProfile.h"
#include "Arena.h"
-
-#ifdef DEBUG_HEAP_PROF
#include "Printer.h"
-static void fprint_data(FILE *fp);
-#endif
/* -----------------------------------------------------------------------------
* era stores the current time period. It is the same as the
initEra( &censuses[era] );
}
-/* -------------------------------------------------------------------------- */
+/* -----------------------------------------------------------------------------
+ * DEBUG heap profiling, by info table
+ * -------------------------------------------------------------------------- */
#ifdef DEBUG_HEAP_PROF
FILE *hp_file;
}
#endif /* DEBUG_HEAP_PROF */
+/* --------------------------------------------------------------------------
+ * Initialize the heap profilier
+ * ----------------------------------------------------------------------- */
nat
initHeapProfiling(void)
{
if (*sel == '\0') return rtsFalse;
}
}
+#endif // PROFILING
-// Figure out whether a closure should be counted in this census, by
-// testing against all the specified constraints.
+/* -----------------------------------------------------------------------------
+ * Figure out whether a closure should be counted in this census, by
+ * testing against all the specified constraints.
+ * -------------------------------------------------------------------------- */
rtsBool
closureSatisfiesConstraints( StgClosure* p )
{
+#ifdef DEBUG_HEAP_PROF
+ return rtsTrue;
+#else
rtsBool b;
if (RtsFlags.ProfFlags.modSelector) {
b = str_matches_selector( ((StgClosure *)p)->header.prof.ccs->cc->module,
return rtsFalse;
}
return rtsTrue;
-}
#endif /* PROFILING */
+}
/* -----------------------------------------------------------------------------
* Aggregate the heap census info for biographical profiling
#ifdef DEBUG_HEAP_PROF
switch (RtsFlags.ProfFlags.doHeapProfile) {
case HEAP_BY_INFOPTR:
- fprint_data(hp_file);
+ fprintf(hp_file, "%s", lookupGHCName(ctr->identity));
break;
case HEAP_BY_CLOSURE_TYPE:
- fprint_closure_types(hp_file);
+ fprintf(hp_file, "%s", (char *)ctr->identity);
break;
}
#endif
}
#endif
+#ifdef PROFILING
stat_startHeapCensus();
+#endif
// traverse the heap, collecting the census info
heapCensusChain( census, small_alloc_list );
// we're into the next time period now
nextEra();
+#ifdef PROFILING
stat_endHeapCensus();
+#endif
}
#endif /* PROFILING || DEBUG_HEAP_PROF */