[project @ 1999-04-08 15:43:44 by simonm]
authorsimonm <unknown>
Thu, 8 Apr 1999 15:43:46 +0000 (15:43 +0000)
committersimonm <unknown>
Thu, 8 Apr 1999 15:43:46 +0000 (15:43 +0000)
Don't set the cost centre when entering a PAP.  Either:

-  it's fully applied, in which case we're about to
   set the CCS in the function anyway, or

-  we're about to build another PAP in which case the
   costs get attributed to the current CCS.

This avoids appending CCSs twice in some cases.

ghc/includes/StgProf.h
ghc/rts/Profiling.c
ghc/rts/Updates.hc

index b221ba7..76fcdc3 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgProf.h,v 1.4 1999/03/25 13:14:04 simonm Exp $
+ * $Id: StgProf.h,v 1.5 1999/04/08 15:43:44 simonm Exp $
  *
  * (c) The GHC Team, 1998
  *
@@ -270,7 +270,8 @@ extern CostCentreStack *CCS_LIST;         /* registered CCS list */
  
 /* These ENTER_CC_PAP things are only used in the RTS */
  
-#define ENTER_CCS_PAP(stack)                                   \
+#define ENTER_CCS_PAP(stack) /* nothing */
+#if 0 /* old version */
         do {                                                   \
         CostCentreStack *ccs = (CostCentreStack *) (stack);    \
         if ( ! IS_CAF_OR_SUB_CCS(ccs) ) {                      \
@@ -282,6 +283,7 @@ extern CostCentreStack *CCS_LIST;         /* registered CCS list */
         }                                                      \
         CCCS_DETAIL_COUNT(CCCS->pap_count);                    \
         } while(0)                      
+#endif
 
 #define ENTER_CCS_PAP_CL(closure)  \
         ENTER_CCS_PAP((closure)->header.prof.ccs)
index eec5a71..69b0881 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Profiling.c,v 1.4 1999/03/25 13:14:06 simonm Exp $
+ * $Id: Profiling.c,v 1.5 1999/04/08 15:43:45 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -291,11 +291,12 @@ AppendCCS ( CostCentreStack *ccs1, CostCentreStack *ccs2 )
 {
   CostCentreStack *ccs;
   IF_DEBUG(prof, 
-          fprintf(stderr,"Appending ");
-          printCCS(ccs1);
-          fprintf(stderr," to ");
-          printCCS(ccs2);
-          fprintf(stderr,"\n"));
+          if (ccs1 != ccs2) {
+            fprintf(stderr,"Appending ");
+            printCCS(ccs1);
+            fprintf(stderr," to ");
+            printCCS(ccs2);
+            fprintf(stderr,"\n");});
   return AppendCCS(ccs1,ccs2);
 }
 #endif
index f5f6928..adc9a6c 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Updates.hc,v 1.13 1999/03/26 10:29:06 simonm Exp $
+ * $Id: Updates.hc,v 1.14 1999/04/08 15:43:46 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -200,7 +200,7 @@ EXTFUN(stg_update_PAP)
 {
   nat Words, PapSize;
 #ifdef PROFILING
-  CostCentreStack *CCS_pap;
+  CostCentreStack *CCS_pap, *CCS_blame;
 #endif
   StgPAP* PapClosure;
   StgClosure *Fun, *Updatee;
@@ -228,6 +228,10 @@ EXTFUN(stg_update_PAP)
 #if defined(PROFILING)
     /* set "CC_pap" to go in the updatee (see Sansom thesis, p 183) */
     CCS_pap = Fun->header.prof.ccs;
+    CCS_blame = Fun->header.prof.ccs;
+    if (IS_CAF_OR_SUB_CCS(CCS_pap)) {
+      CCS_blame = CCCS;
+    }
 #endif
 
     if (Words == 0) { 
@@ -264,7 +268,7 @@ EXTFUN(stg_update_PAP)
 
        TICK_ALLOC_UPD_PAP(1/*fun*/ + Words, 0);
 #ifdef PROFILING
-       CCS_ALLOC(CCS_pap, PapSize);
+       CCS_ALLOC(CCS_blame, PapSize);
 #endif
 
        PapClosure = (StgPAP *)(Hp + 1 - PapSize); /* The new PapClosure */