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.
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $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
*
*
* (c) The GHC Team, 1998
*
/* These ENTER_CC_PAP things are only used in the RTS */
/* 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) ) { \
do { \
CostCentreStack *ccs = (CostCentreStack *) (stack); \
if ( ! IS_CAF_OR_SUB_CCS(ccs) ) { \
} \
CCCS_DETAIL_COUNT(CCCS->pap_count); \
} while(0)
} \
CCCS_DETAIL_COUNT(CCCS->pap_count); \
} while(0)
#define ENTER_CCS_PAP_CL(closure) \
ENTER_CCS_PAP((closure)->header.prof.ccs)
#define ENTER_CCS_PAP_CL(closure) \
ENTER_CCS_PAP((closure)->header.prof.ccs)
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $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
*
*
* (c) The GHC Team, 1998-1999
*
{
CostCentreStack *ccs;
IF_DEBUG(prof,
{
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
return AppendCCS(ccs1,ccs2);
}
#endif
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $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
*
*
* (c) The GHC Team, 1998-1999
*
{
nat Words, PapSize;
#ifdef PROFILING
{
nat Words, PapSize;
#ifdef PROFILING
- CostCentreStack *CCS_pap;
+ CostCentreStack *CCS_pap, *CCS_blame;
#endif
StgPAP* PapClosure;
StgClosure *Fun, *Updatee;
#endif
StgPAP* PapClosure;
StgClosure *Fun, *Updatee;
#if defined(PROFILING)
/* set "CC_pap" to go in the updatee (see Sansom thesis, p 183) */
CCS_pap = Fun->header.prof.ccs;
#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;
+ }
TICK_ALLOC_UPD_PAP(1/*fun*/ + Words, 0);
#ifdef PROFILING
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 */
#endif
PapClosure = (StgPAP *)(Hp + 1 - PapSize); /* The new PapClosure */