[project @ 1998-11-26 09:17:22 by sof]
[ghc-hetmet.git] / ghc / includes / CostCentre.lh
index 79c4272..acc800e 100644 (file)
@@ -47,7 +47,7 @@ source using the @CC_DECLARE@ macro where @label@, @module@ and
 \begin{code} 
 # define CC_IS_CAF      'c'
 # define CC_IS_DICT     'd'
-# define CC_IS_SUBSUMED 'S'
+# define CC_IS_SUBSUMED 's'
 # define CC_IS_BORING   'B'
 
 # define STATIC_CC_REF(cc_ident) &CAT2(cc_ident,_struct)
@@ -156,11 +156,9 @@ CC_EXTERN(CC_DONTZuCARE);          /* placeholder only */
 CC_EXTERN(CC_CAFs);            /* prelude cost centre (CAFs  only) */
 CC_EXTERN(CC_DICTs);           /* prelude cost centre (DICTs only) */
 
-# define IS_CAF_OR_DICT_CC(cc) \
+# define IS_CAF_OR_DICT_OR_SUB_CC(cc) \
     ((cc)->is_subsumed & ' ')  /* tests for lower case character */
 
-# define IS_SUBSUMED_CC(cc) ((cc)->is_subsumed == CC_IS_SUBSUMED)
-
 \end{code}
 
 Definitions referring to the Cost Centre sub-field of the fixed header.
@@ -268,7 +266,7 @@ On entering a closure we only count the enter to thunks ...
        do {                                            \
        CostCentre cc = (CostCentre) (centre);          \
        ASSERT_IS_REGISTERED(cc,1);                     \
-       if ( ! IS_CAF_OR_DICT_CC(cc) ) {                \
+       if ( ! IS_CAF_OR_DICT_OR_SUB_CC(cc) ) {         \
            CCC = cc;                                   \
        } else {                                        \
            CCC_DETAIL_COUNT(cc->caffun_subsumed);      \
@@ -308,8 +306,9 @@ On entering a closure we only count the enter to thunks ...
        do {                                            \
        CostCentre cc = (CostCentre) (centre);          \
        ASSERT_IS_REGISTERED(cc,1);                     \
-       if ( ! IS_CAF_OR_DICT_CC(cc) ) {                \
+       if ( ! IS_CAF_OR_DICT_OR_SUB_CC(cc) ) {         \
            CCC = cc;                                   \
+           CCC->scc_count++;                           \
        } else {                                        \
            CCC_DETAIL_COUNT(cc->caffun_subsumed);      \
            CCC_DETAIL_COUNT(CCC->subsumed_caf_count);  \
@@ -396,6 +395,15 @@ extern F_ *register_stack;
        } while(0);                                                     \
        FUNEND; }
 
+#else  /* PROFILING */
+
+/* When things are working these shouldn't be emitted when not profiling,
+   but it was convenient at one point to have them expand to nothing 
+    when not profiling.  SLPJ Dec 96 */
+
+#define START_REGISTER_CCS(reg_mod_name)
+#define END_REGISTER_CCS()
+
 #endif  /* PROFILING */
 \end{code}
 
@@ -408,7 +416,7 @@ We don't want to attribute costs to an unregistered cost-centre:
        do {    /* beware of cc name-capture */                                 \
        CostCentre c_c = (CostCentre) (cc);                                     \
        if (c_c->registered == NOT_REGISTERED) {                                \
-           fprintf(stderr,"Entering unregistered CC: %s\n",c_c->label);        \
+           fprintf(stderr,"Entering unregistered CC: %s %s\n",c_c->module, c_c->label);        \
            /* unsafe c-call, BTW */                                            \
        }                                                                       \
        if ( (chk_not_overhead) && c_c == STATIC_CC_REF(CC_OVERHEAD) ) {        \
@@ -662,12 +670,12 @@ rtsBool cc_to_ignore PROTO((CostCentre));
 
 I_ heap_profile_init PROTO((char *argv[]));
 
-extern void heap_profile_finish(STG_NO_ARGS);
+void heap_profile_finish(STG_NO_ARGS);
 
-extern void heap_profile_setup(STG_NO_ARGS);      /* called at start of heap profile */
-extern void heap_profile_done(STG_NO_ARGS);      /* called at end of heap profile */
+void heap_profile_setup(STG_NO_ARGS);      /* called at start of heap profile */
+void heap_profile_done(STG_NO_ARGS);     /* called at end of heap profile */
 
-extern void (* heap_profile_fn) PROTO((P_ closure,I_ size));
+void (* heap_profile_fn) PROTO((P_ closure,I_ size));
 
 extern I_ earlier_ticks;               /* no. of earlier ticks grouped */
 extern hash_t time_intervals;          /* no. of time intervals reported -- 18 */