Make it work in a DEBUG world again (when DEBUG is on we have ancient
support for doing a heap profile based on info-tables - it is still
there, but I haven't tested it).
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $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.
*
*
* (c) The GHC Team, 1994-2000.
*
static void enZcode ( char *in, char *out );
#endif
static char unZcode ( char ch );
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 );
/* --------------------------------------------------------------------------
static void printZcoded ( const char *raw );
/* --------------------------------------------------------------------------
void printPtr( StgPtr p )
{
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);
printZcoded(raw);
} else {
fprintf(stdout, "%p", p);
-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) {
{
nat i;
for( i = 0; i < table_size && table[i].value != (unsigned) addr; ++i ) {
}
if (i < table_size) {
- *result = table[i].name;
- return rtsTrue;
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $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
*
*
* (c) The GHC Team, 1998-2000
*
extern void DEBUG_LoadSymbols( char *name );
extern void DEBUG_LoadSymbols( char *name );
-extern rtsBool lookupGHCName( StgPtr addr, const char **result );
+extern const char *lookupGHCName( void *addr );
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $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
*
*
* (c) The GHC Team, 1998-2000
*
#include "RetainerProfile.h"
#include "LdvProfile.h"
#include "Arena.h"
#include "RetainerProfile.h"
#include "LdvProfile.h"
#include "Arena.h"
-
-#ifdef DEBUG_HEAP_PROF
-static void fprint_data(FILE *fp);
-#endif
/* -----------------------------------------------------------------------------
* era stores the current time period. It is the same as the
/* -----------------------------------------------------------------------------
* era stores the current time period. It is the same as the
initEra( &censuses[era] );
}
initEra( &censuses[era] );
}
-/* -------------------------------------------------------------------------- */
+/* -----------------------------------------------------------------------------
+ * DEBUG heap profiling, by info table
+ * -------------------------------------------------------------------------- */
#ifdef DEBUG_HEAP_PROF
FILE *hp_file;
#ifdef DEBUG_HEAP_PROF
FILE *hp_file;
}
#endif /* DEBUG_HEAP_PROF */
}
#endif /* DEBUG_HEAP_PROF */
+/* --------------------------------------------------------------------------
+ * Initialize the heap profilier
+ * ----------------------------------------------------------------------- */
nat
initHeapProfiling(void)
{
nat
initHeapProfiling(void)
{
if (*sel == '\0') return rtsFalse;
}
}
if (*sel == '\0') return rtsFalse;
}
}
-// 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 )
{
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,
rtsBool b;
if (RtsFlags.ProfFlags.modSelector) {
b = str_matches_selector( ((StgClosure *)p)->header.prof.ccs->cc->module,
return rtsFalse;
}
return rtsTrue;
return rtsFalse;
}
return rtsTrue;
/* -----------------------------------------------------------------------------
* Aggregate the heap census info for biographical profiling
/* -----------------------------------------------------------------------------
* Aggregate the heap census info for biographical profiling
#ifdef DEBUG_HEAP_PROF
switch (RtsFlags.ProfFlags.doHeapProfile) {
case HEAP_BY_INFOPTR:
#ifdef DEBUG_HEAP_PROF
switch (RtsFlags.ProfFlags.doHeapProfile) {
case HEAP_BY_INFOPTR:
+ fprintf(hp_file, "%s", lookupGHCName(ctr->identity));
break;
case HEAP_BY_CLOSURE_TYPE:
break;
case HEAP_BY_CLOSURE_TYPE:
- fprint_closure_types(hp_file);
+ fprintf(hp_file, "%s", (char *)ctr->identity);
// traverse the heap, collecting the census info
heapCensusChain( census, small_alloc_list );
// traverse the heap, collecting the census info
heapCensusChain( census, small_alloc_list );
// we're into the next time period now
nextEra();
// we're into the next time period now
nextEra();
}
#endif /* PROFILING || DEBUG_HEAP_PROF */
}
#endif /* PROFILING || DEBUG_HEAP_PROF */