[project @ 2005-07-21 09:56:26 by simonmar]
[ghc-hetmet.git] / ghc / rts / ProfHeap.c
index 482895f..f30ef5d 100644 (file)
@@ -744,15 +744,15 @@ dumpCensus( Census *census )
 
 #ifdef PROFILING
     if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
-       fprintf(hp_file, "VOID\t%lu\n", census->void_total * sizeof(W_));
+      fprintf(hp_file, "VOID\t%lu\n", (unsigned long)(census->void_total) * sizeof(W_));
        fprintf(hp_file, "LAG\t%lu\n", 
-               (census->not_used - census->void_total) * sizeof(W_));
+               (unsigned long)(census->not_used - census->void_total) * sizeof(W_));
        fprintf(hp_file, "USE\t%lu\n", 
-               (census->used - census->drag_total) * sizeof(W_));
+               (unsigned long)(census->used - census->drag_total) * sizeof(W_));
        fprintf(hp_file, "INHERENT_USE\t%lu\n", 
-               census->prim * sizeof(W_));
-       fprintf(hp_file, "DRAG\t%lu\n", census->drag_total *
-               sizeof(W_));
+               (unsigned long)(census->prim) * sizeof(W_));
+       fprintf(hp_file, "DRAG\t%lu\n",
+               (unsigned long)(census->drag_total) * sizeof(W_));
        printSample(rtsFalse, census->time);
        return;
     }
@@ -830,7 +830,7 @@ dumpCensus( Census *census )
        }
 #endif
 
-       fprintf(hp_file, "\t%ld\n", count * sizeof(W_));
+       fprintf(hp_file, "\t%lu\n", (unsigned long)count * sizeof(W_));
     }
 
     printSample(rtsFalse, census->time);
@@ -867,9 +867,24 @@ heapCensusChain( Census *census, bdescr *bd )
            
            switch (info->type) {
 
+           case THUNK:
+               size = thunk_sizeW_fromITBL(info);
+               break;
+
+           case THUNK_1_1:
+           case THUNK_0_2:
+           case THUNK_2_0:
+               size = sizeofW(StgHeader) + stg_max(MIN_UPD_SIZE,2);
+               break;
+
+           case THUNK_1_0:
+           case THUNK_0_1:
+           case THUNK_SELECTOR:
+               size = sizeofW(StgHeader) + stg_max(MIN_UPD_SIZE,1);
+               break;
+
            case CONSTR:
            case FUN:
-           case THUNK:
            case IND_PERM:
            case IND_OLDGEN:
            case IND_OLDGEN_PERM:
@@ -884,9 +899,6 @@ heapCensusChain( Census *census, bdescr *bd )
            case FUN_1_1:
            case FUN_0_2:
            case FUN_2_0:
-           case THUNK_1_1:
-           case THUNK_0_2:
-           case THUNK_2_0:
            case CONSTR_1_0:
            case CONSTR_0_1:
            case CONSTR_1_1:
@@ -909,13 +921,10 @@ heapCensusChain( Census *census, bdescr *bd )
                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;
+           case AP:
+               size = ap_sizeW((StgAP *)p);
                break;
 
-           case AP:
            case PAP:
                size = pap_sizeW((StgPAP *)p);
                break;