From 6a19a2b9a6a66f65f2f3f6b283d20523947f2a5f Mon Sep 17 00:00:00 2001 From: simonm Date: Thu, 8 Apr 1999 15:43:46 +0000 Subject: [PATCH] [project @ 1999-04-08 15:43:44 by simonm] 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 | 6 ++++-- ghc/rts/Profiling.c | 13 +++++++------ ghc/rts/Updates.hc | 10 +++++++--- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ghc/includes/StgProf.h b/ghc/includes/StgProf.h index b221ba7..76fcdc3 100644 --- a/ghc/includes/StgProf.h +++ b/ghc/includes/StgProf.h @@ -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) diff --git a/ghc/rts/Profiling.c b/ghc/rts/Profiling.c index eec5a71..69b0881 100644 --- a/ghc/rts/Profiling.c +++ b/ghc/rts/Profiling.c @@ -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 diff --git a/ghc/rts/Updates.hc b/ghc/rts/Updates.hc index f5f6928..adc9a6c 100644 --- a/ghc/rts/Updates.hc +++ b/ghc/rts/Updates.hc @@ -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 */ -- 1.7.10.4