[project @ 2000-03-31 03:09:35 by hwloidl]
[ghc-hetmet.git] / ghc / rts / ProfHeap.c
index 2f28e58..c2d534f 100644 (file)
@@ -1,7 +1,7 @@
 /* -----------------------------------------------------------------------------
- * $Id: ProfHeap.c,v 1.1 1999/09/15 13:46:28 simonmar Exp $
+ * $Id: ProfHeap.c,v 1.9 2000/03/31 03:09:36 hwloidl Exp $
  *
- * (c) The GHC Team, 1998-1999
+ * (c) The GHC Team, 1998-2000
  *
  * Support for heap profiling
  *
@@ -31,8 +31,25 @@ static void fprint_data(FILE *fp);
 #endif
 
 char prof_filename[128];       /* urk */
+
+#ifdef DEBUG_HEAP_PROF
 FILE *prof_file;
 
+void initProfiling1( void )
+{
+}
+
+void initProfiling2( void )
+{
+  initHeapProfiling();
+}
+
+void endProfiling( void )
+{
+  endHeapProfiling();
+}
+#endif /* DEBUG_HEAP_PROF */
+
 nat
 initHeapProfiling(void)
 {
@@ -40,15 +57,6 @@ initHeapProfiling(void)
         return 0;
     }
 
-    sprintf(prof_filename, "%.124s.hp", prog_argv[0]);
-
-    prof_file = fopen(prof_filename, "w");
-    if (prof_file == NULL) {
-       fprintf(stderr, "Can't open heap profiling log file %s\n",
-               prof_filename);
-       return 1;
-    }
-
     fprintf(prof_file, "JOB \"%s\"\n", prog_argv[0]);
     fprintf(prof_file, "DATE \"%s\"\n", time_str());
 
@@ -262,7 +270,9 @@ clearCCSResid(CostCentreStack *ccs)
   ccs->mem_resid = 0;
 
   for (i = ccs->indexTable; i != 0; i = i->next) {
-    clearCCSResid(i->ccs);
+    if (!i->back_edge) {
+      clearCCSResid(i->ccs);
+    }
   }
 }
 
@@ -299,7 +309,9 @@ reportCCSResid(FILE *fp, CostCentreStack *ccs)
   }
 
   for (i = ccs->indexTable; i != 0; i = i->next) {
-    reportCCSResid(fp,i->ccs);
+    if (!i->back_edge) {
+      reportCCSResid(fp,i->ccs);
+    }
   }
 }
 #endif
@@ -319,7 +331,10 @@ heapCensus(void)
     clear_table_data();
     break;
   case HEAP_BY_CLOSURE_TYPE:
+#if 0
+#   error fix me      
     memset(closure_types, 0, N_CLOSURE_TYPES * sizeof(nat));
+#endif
     break;
   default:
     return;
@@ -384,8 +399,6 @@ heapCensus(void)
       case FUN_1_1:
       case FUN_0_2:
       case FUN_2_0:
-      case THUNK_1_0:
-      case THUNK_0_1:
       case THUNK_1_1:
       case THUNK_0_2:
       case THUNK_2_0:
@@ -397,6 +410,8 @@ heapCensus(void)
        size = sizeW_fromITBL(info);
        break;
        
+      case THUNK_1_0:          /* ToDo - shouldn't be here */
+      case THUNK_0_1:          /* "  ditto  " */
       case THUNK_SELECTOR:
        size = sizeofW(StgHeader) + MIN_UPD_SIZE;
        break;