X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FTicky.c;h=140a705eaea5b888f1cf0f58c293afb7468a29eb;hb=209e093599d0d4db5487d124895d817c55b7c052;hp=294e12bdda6b011b65226e2e4634cad2fb986db9;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/rts/Ticky.c b/rts/Ticky.c index 294e12b..140a705 100644 --- a/rts/Ticky.c +++ b/rts/Ticky.c @@ -6,12 +6,29 @@ * Ticky-ticky profiling *-------------------------------------------------------------------------- */ -#if defined(TICKY_TICKY) - #define TICKY_C /* define those variables */ #include "PosixSource.h" #include "Rts.h" -#include "RtsFlags.h" + +/* Catch-all top-level counter struct. Allocations from CAFs will go + * here. + */ +StgEntCounter top_ct + = { 0, 0, 0, + "TOP", "", + 0, 0, NULL }; + +/* Data structure used in ``registering'' one of these counters. */ + +StgEntCounter *ticky_entry_ctrs = NULL; /* root of list of them */ + +/* We want Haskell code compiled with -ticky to be linkable with any + * version of the RTS, so we have to make sure all the symbols that + * ticky-compiled code may refer to are defined by every RTS. (#3439) + * Hence the #ifdef is here, rather than up above. + */ +#if defined(TICKY_TICKY) + #include "Ticky.h" /* ----------------------------------------------------------------------------- @@ -29,54 +46,51 @@ static void printRegisteredCounterInfo (FILE *); /* fwd decl */ void PrintTickyInfo(void) { - unsigned long i; + // XXX This is only used in commented out or #if FALSE'd out code currently: + // unsigned long i; + +/* XXX These are used only in an #if FALSE block below */ +#if FALSE unsigned long tot_allocs = /* total number of things allocated */ ALLOC_FUN_ctr + ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr + ALLOC_CON_ctr + ALLOC_TUP_ctr + + ALLOC_TSO_ctr + ALLOC_BH_ctr + ALLOC_PAP_ctr + ALLOC_PRIM_ctr -#ifdef PAR - + ALLOC_FMBQ_ctr + ALLOC_FME_ctr + ALLOC_BF_ctr -#endif ; unsigned long tot_adm_wds = /* total number of admin words allocated */ ALLOC_FUN_adm + ALLOC_THK_adm + ALLOC_CON_adm + ALLOC_TUP_adm + ALLOC_TSO_adm + ALLOC_BH_adm + ALLOC_PAP_adm + ALLOC_PRIM_adm -#ifdef PAR - + ALLOC_FMBQ_adm + ALLOC_FME_adm + ALLOC_BF_adm -#endif ; unsigned long tot_gds_wds = /* total number of words of ``good stuff'' allocated */ ALLOC_FUN_gds + ALLOC_THK_gds + ALLOC_CON_gds + ALLOC_TUP_gds + ALLOC_TSO_gds + ALLOC_BH_gds + ALLOC_PAP_gds + ALLOC_PRIM_gds -#ifdef PAR - + ALLOC_FMBQ_gds + ALLOC_FME_gds + ALLOC_BF_gds -#endif ; unsigned long tot_slp_wds = /* total number of ``slop'' words allocated */ ALLOC_FUN_slp + ALLOC_THK_slp + ALLOC_CON_slp + ALLOC_TUP_slp + ALLOC_TSO_slp + ALLOC_BH_slp + ALLOC_PAP_slp + ALLOC_PRIM_slp -#ifdef PAR - + ALLOC_FMBQ_slp + ALLOC_FME_slp + ALLOC_BF_slp -#endif ; unsigned long tot_wds = /* total words */ tot_adm_wds + tot_gds_wds + tot_slp_wds; +#endif unsigned long tot_thk_enters = ENT_STATIC_THK_ctr + ENT_DYN_THK_ctr; unsigned long tot_con_enters = ENT_STATIC_CON_ctr + ENT_DYN_CON_ctr; + unsigned long tot_fun_direct_enters = ENT_STATIC_FUN_DIRECT_ctr + ENT_DYN_FUN_DIRECT_ctr; unsigned long tot_ind_enters = ENT_STATIC_IND_ctr + ENT_DYN_IND_ctr; // This is the number of times we entered a function via some kind // of slow call. It amounts to all the slow applications, not // counting those that were to too few arguments. + /* + XXX This us unused - can we delete it? -- IGL 2008-04-25 unsigned long tot_fun_slow_enters = SLOW_CALL_ctr - SLOW_CALL_FUN_TOO_FEW_ctr - SLOW_CALL_PAP_TOO_FEW_ctr; + */ unsigned long tot_known_calls = KNOWN_CALL_ctr + KNOWN_CALL_TOO_FEW_ARGS_ctr + @@ -84,12 +98,13 @@ PrintTickyInfo(void) unsigned long tot_tail_calls = UNKNOWN_CALL_ctr + tot_known_calls; - unsigned long tot_enters = - tot_con_enters + tot_fun_direct_enters + + unsigned long tot_enters = + tot_con_enters + tot_fun_direct_enters + tot_ind_enters + ENT_PERM_IND_ctr + ENT_PAP_ctr + tot_thk_enters; unsigned long jump_direct_enters = tot_enters - ENT_VIA_NODE_ctr; + unsigned long tot_returns = RET_NEW_ctr + RET_OLD_ctr + RET_UNBOXED_TUP_ctr; @@ -106,6 +121,16 @@ PrintTickyInfo(void) FILE *tf = RtsFlags.TickyFlags.tickyFile; + /* If tf = NULL, that means the user passed in stderr for the ticky stats + file. According to a comment in RtsFlags.c, this means to use + debugBelch to print out messages. But this function prints out a lot + of stuff so in order to avoid changing a lot of code, we just dump + the same output to stderr (for now). */ + if( tf == NULL ) + tf = stderr; + + /* krc: avoid dealing with this just now */ +#if FALSE fprintf(tf,"\n\nALLOCATIONS: %ld (%ld words total: %ld admin, %ld goods, %ld slop)\n", tot_allocs, tot_wds, tot_adm_wds, tot_gds_wds, tot_slp_wds); fprintf(tf,"\t\t\t\ttotal words:\t 2 3 4 5 6+\n"); @@ -122,6 +147,7 @@ PrintTickyInfo(void) PC(INTAVG(ALLOC_FUN_ctr, tot_allocs))); if (ALLOC_FUN_ctr != 0) fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FUN)); + fprintf(tf,"\n%7ld (%5.1f%%) thunks", ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr, @@ -168,29 +194,16 @@ PrintTickyInfo(void) PC(INTAVG(ALLOC_TSO_ctr, tot_allocs))); if (ALLOC_TSO_ctr != 0) fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TSO)); -#ifdef PAR - fprintf(tf,"\n%7ld (%5.1f%%) thread state objects", - ALLOC_FMBQ_ctr, - PC(INTAVG(ALLOC_FMBQ_ctr, tot_allocs))); - if (ALLOC_FMBQ_ctr != 0) - fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FMBQ)); - fprintf(tf,"\n%7ld (%5.1f%%) thread state objects", - ALLOC_FME_ctr, - PC(INTAVG(ALLOC_FME_ctr, tot_allocs))); - if (ALLOC_FME_ctr != 0) - fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FME)); - fprintf(tf,"\n%7ld (%5.1f%%) thread state objects", - ALLOC_BF_ctr, - PC(INTAVG(ALLOC_BF_ctr, tot_allocs))); - if (ALLOC_BF_ctr != 0) - fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(BF)); -#endif + fprintf(tf,"\n"); fprintf(tf,"\nTotal storage-manager allocations: %ld (%ld words)\n\t[%ld words lost to speculative heap-checks]\n", ALLOC_HEAP_ctr, ALLOC_HEAP_tot, ALLOC_HEAP_tot - tot_wds); +#endif /* FALSE */ + fprintf(tf,"\nSTACK USAGE:\n"); /* NB: some bits are direction sensitive */ + fprintf(tf,"\nENTERS: %ld of which %ld (%.1f%%) direct to the entry code\n\t\t [the rest indirected via Node's info ptr]\n", tot_enters, jump_direct_enters, @@ -208,6 +221,7 @@ PrintTickyInfo(void) ENT_PERM_IND_ctr, PC(INTAVG(ENT_PERM_IND_ctr,tot_enters))); + fprintf(tf,"\nFUNCTION ENTRIES: %ld\n", tot_fun_direct_enters); fprintf(tf, "\nTAIL CALLS: %ld, of which %ld (%.lf%%) were to known functions\n", @@ -228,10 +242,10 @@ PrintTickyInfo(void) fprintf(tf,"%7ld (%5.1f%%) from entering a new constructor\n\t\t [the rest from entering an existing constructor]\n", tot_returns_of_new, PC(INTAVG(tot_returns_of_new,tot_returns))); - fprintf(tf,"%7ld (%5.1f%%) vectored [the rest unvectored]\n", - VEC_RETURN_ctr, - PC(INTAVG(VEC_RETURN_ctr,tot_returns))); + /* krc: comment out some of this stuff temporarily */ + + /* fprintf(tf, "\nRET_NEW: %7ld: ", RET_NEW_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_NEW_hst[i],RET_NEW_ctr))); } @@ -245,10 +259,7 @@ PrintTickyInfo(void) PC(INTAVG(RET_UNBOXED_TUP_hst[i], RET_UNBOXED_TUP_ctr))); } fprintf(tf, "\n"); - fprintf(tf, "\nRET_VEC_RETURN : %7ld: ", VEC_RETURN_ctr); - for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%", - PC(INTAVG(RET_VEC_RETURN_hst[i],VEC_RETURN_ctr))); } - fprintf(tf, "\n"); + */ fprintf(tf,"\nUPDATE FRAMES: %ld (%ld omitted from thunks)", UPDF_PUSHED_ctr, @@ -274,6 +285,8 @@ PrintTickyInfo(void) UPD_SQUEEZED_ctr, PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates))); + /* krc: also avoid dealing with this for now */ +#if FALSE fprintf(tf, "\nUPD_CON_IN_NEW: %7ld: ", UPD_CON_IN_NEW_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_NEW_hst[i]); } fprintf(tf, "\n"); @@ -283,6 +296,7 @@ PrintTickyInfo(void) fprintf(tf, "UPD_PAP_IN_NEW: %7ld: ", UPD_PAP_IN_NEW_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_PAP_IN_NEW_hst[i]); } fprintf(tf, "\n"); +#endif if (tot_gengc_updates != 0) { fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n", @@ -293,9 +307,6 @@ PrintTickyInfo(void) PC(INTAVG(tot_old_updates,tot_gengc_updates))); } - fprintf(tf,"\nTotal bytes copied during GC: %ld\n", - GC_WORDS_COPIED_ctr * sizeof(W_)); - printRegisteredCounterInfo(tf); fprintf(tf,"\n**************************************************\n"); @@ -320,6 +331,8 @@ PrintTickyInfo(void) PR_CTR(ALLOC_FUN_adm); PR_CTR(ALLOC_FUN_gds); PR_CTR(ALLOC_FUN_slp); + + /* krc: comment out some of this stuff temporarily PR_HST(ALLOC_FUN_hst,0); PR_HST(ALLOC_FUN_hst,1); PR_HST(ALLOC_FUN_hst,2); @@ -390,36 +403,7 @@ PrintTickyInfo(void) PR_HST(ALLOC_TSO_hst,2); PR_HST(ALLOC_TSO_hst,3); PR_HST(ALLOC_TSO_hst,4); - -#ifdef PAR - PR_CTR(ALLOC_FMBQ_ctr); - PR_CTR(ALLOC_FMBQ_adm); - PR_CTR(ALLOC_FMBQ_gds); - PR_CTR(ALLOC_FMBQ_slp); - PR_HST(ALLOC_FMBQ_hst,0); - PR_HST(ALLOC_FMBQ_hst,1); - PR_HST(ALLOC_FMBQ_hst,2); - PR_HST(ALLOC_FMBQ_hst,3); - PR_HST(ALLOC_FMBQ_hst,4); - PR_CTR(ALLOC_FME_ctr); - PR_CTR(ALLOC_FME_adm); - PR_CTR(ALLOC_FME_gds); - PR_CTR(ALLOC_FME_slp); - PR_HST(ALLOC_FME_hst,0); - PR_HST(ALLOC_FME_hst,1); - PR_HST(ALLOC_FME_hst,2); - PR_HST(ALLOC_FME_hst,3); - PR_HST(ALLOC_FME_hst,4); - PR_CTR(ALLOC_BF_ctr); - PR_CTR(ALLOC_BF_adm); - PR_CTR(ALLOC_BF_gds); - PR_CTR(ALLOC_BF_slp); - PR_HST(ALLOC_BF_hst,0); - PR_HST(ALLOC_BF_hst,1); - PR_HST(ALLOC_BF_hst,2); - PR_HST(ALLOC_BF_hst,3); - PR_HST(ALLOC_BF_hst,4); -#endif + */ PR_CTR(ENT_VIA_NODE_ctr); PR_CTR(ENT_STATIC_CON_ctr); @@ -481,6 +465,9 @@ PrintTickyInfo(void) PR_CTR(SLOW_CALL_PAP_CORRECT_ctr); PR_CTR(SLOW_CALL_PAP_TOO_MANY_ctr); PR_CTR(SLOW_CALL_UNEVALD_ctr); + + /* krc: put off till later... */ +#if FALSE PR_HST(SLOW_CALL_hst,0); PR_HST(SLOW_CALL_hst,1); PR_HST(SLOW_CALL_hst,2); @@ -489,12 +476,14 @@ PrintTickyInfo(void) PR_HST(SLOW_CALL_hst,5); PR_HST(SLOW_CALL_hst,6); PR_HST(SLOW_CALL_hst,7); +#endif PR_CTR(RET_NEW_ctr); PR_CTR(RET_OLD_ctr); PR_CTR(RET_UNBOXED_TUP_ctr); - PR_CTR(VEC_RETURN_ctr); + /* krc: put off till later... */ +#if FALSE PR_HST(RET_NEW_hst,0); PR_HST(RET_NEW_hst,1); PR_HST(RET_NEW_hst,2); @@ -522,15 +511,7 @@ PrintTickyInfo(void) PR_HST(RET_UNBOXED_TUP_hst,6); PR_HST(RET_UNBOXED_TUP_hst,7); PR_HST(RET_UNBOXED_TUP_hst,8); - PR_HST(RET_VEC_RETURN_hst,0); - PR_HST(RET_VEC_RETURN_hst,1); - PR_HST(RET_VEC_RETURN_hst,2); - PR_HST(RET_VEC_RETURN_hst,3); - PR_HST(RET_VEC_RETURN_hst,4); - PR_HST(RET_VEC_RETURN_hst,5); - PR_HST(RET_VEC_RETURN_hst,6); - PR_HST(RET_VEC_RETURN_hst,7); - PR_HST(RET_VEC_RETURN_hst,8); +#endif /* FALSE */ PR_CTR(UPDF_OMITTED_ctr); PR_CTR(UPDF_PUSHED_ctr); @@ -550,6 +531,8 @@ PrintTickyInfo(void) PR_CTR(UPD_CAF_BH_UPDATABLE_ctr); PR_CTR(UPD_CAF_BH_SINGLE_ENTRY_ctr); + /* krc: put off till later...*/ +#if FALSE PR_HST(UPD_CON_IN_NEW_hst,0); PR_HST(UPD_CON_IN_NEW_hst,1); PR_HST(UPD_CON_IN_NEW_hst,2); @@ -568,6 +551,7 @@ PrintTickyInfo(void) PR_HST(UPD_PAP_IN_NEW_hst,6); PR_HST(UPD_PAP_IN_NEW_hst,7); PR_HST(UPD_PAP_IN_NEW_hst,8); +#endif /* FALSE */ PR_CTR(UPD_NEW_IND_ctr); /* see comment on ENT_PERM_IND_ctr */ @@ -580,13 +564,8 @@ PrintTickyInfo(void) PR_CTR(GC_SEL_MINOR_ctr); PR_CTR(GC_SEL_MAJOR_ctr); PR_CTR(GC_FAILED_PROMOTION_ctr); - PR_CTR(GC_WORDS_COPIED_ctr); } -/* Data structure used in ``registering'' one of these counters. */ - -StgEntCounter *ticky_entry_ctrs = NULL; /* root of list of them */ - /* To print out all the registered-counter info: */ static void @@ -603,11 +582,11 @@ printRegisteredCounterInfo (FILE *tf) /* Function name at the end so it doesn't mess up the tabulation */ for (p = ticky_entry_ctrs; p != NULL; p = p->link) { - fprintf(tf, "%11ld%11ld %6u%6u %-11s%-30s", + fprintf(tf, "%11ld%11ld %6lu%6lu %-11s%-30s", p->entry_count, p->allocs, - p->arity, - p->stk_args, + (unsigned long)p->arity, + (unsigned long)p->stk_args, p->arg_kinds, p->str); @@ -615,14 +594,5 @@ printRegisteredCounterInfo (FILE *tf) } } - -/* Catch-all top-level counter struct. Allocations from CAFs will go - * here. - */ -StgEntCounter top_ct - = { 0, 0, 0, - "TOP", "", - 0, 0, NULL }; - #endif /* TICKY_TICKY */