From 1e295cefb7bf257899dee252917c40f5850e8627 Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 24 Jun 1999 13:10:32 +0000 Subject: [PATCH] [project @ 1999-06-24 13:10:31 by simonmar] Reinstate per-function entry counts in ticky-ticky profiles. --- ghc/includes/StgTicky.h | 34 ++++++++++++++++++++++++++++++++-- ghc/rts/Ticky.c | 26 +++++++------------------- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/ghc/includes/StgTicky.h b/ghc/includes/StgTicky.h index 705fdfd..dc0a478 100644 --- a/ghc/includes/StgTicky.h +++ b/ghc/includes/StgTicky.h @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- - * $Id: StgTicky.h,v 1.4 1999/05/11 16:47:42 keithw Exp $ + * $Id: StgTicky.h,v 1.5 1999/06/24 13:10:31 simonmar Exp $ * * (c) The AQUA project, Glasgow University, 1994-1997 * (c) The GHC Team, 1998-1999 @@ -126,7 +126,37 @@ #define TICK_ENT_THK() ENT_THK_ctr++ /* thunk */ #define TICK_ENT_FUN_STD() ENT_FUN_STD_ctr++ /* std entry pt */ -#define TICK_ENT_FUN_DIRECT(n) ENT_FUN_DIRECT_ctr++ /* fast entry pt */ + +struct ent_counter { + unsigned registeredp:16, /* 0 == no, 1 == yes */ + arity:16, /* arity (static info) */ + stk_args:16; /* # of args off stack */ + /* (rest of args are in registers) */ + StgChar *f_str; /* name of the thing */ + StgChar *f_arg_kinds; /* info about the args types */ + I_ ctr; /* the actual counter */ + struct ent_counter *link; /* link to chain them all together */ +}; + +#define TICK_ENT_FUN_DIRECT(f_ct, f_str, f_arity, f_args, f_arg_kinds) \ + { \ + static struct ent_counter f_ct \ + = { 0, \ + (f_arity), (f_args), (f_str), (f_arg_kinds), \ + 0, NULL }; \ + if ( ! f_ct.registeredp ) { \ + /* hook this one onto the front of the list */ \ + f_ct.link = ticky_entry_ctrs; \ + ticky_entry_ctrs = & (f_ct); \ + \ + /* mark it as "registered" */ \ + f_ct.registeredp = 1; \ + } \ + f_ct.ctr += 1; \ + } \ + ENT_FUN_DIRECT_ctr++ /* the old boring one */ + +extern struct ent_counter *ticky_entry_ctrs; #define TICK_ENT_CON(n) ENT_CON_ctr++ /* enter constructor */ #define TICK_ENT_IND(n) ENT_IND_ctr++ /* enter indirection */ diff --git a/ghc/rts/Ticky.c b/ghc/rts/Ticky.c index d059808..1828aa8 100644 --- a/ghc/rts/Ticky.c +++ b/ghc/rts/Ticky.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Ticky.c,v 1.7 1999/05/11 16:49:44 keithw Exp $ + * $Id: Ticky.c,v 1.8 1999/06/24 13:10:32 simonmar Exp $ * * (c) The AQUA project, Glasgow University, 1992-1997 * (c) The GHC Team, 1998-1999 @@ -272,9 +272,7 @@ PrintTickyInfo(void) fprintf(tf,"\nTotal bytes copied during GC: %ld\n", GC_WORDS_COPIED_ctr * sizeof(W_)); -#if 0 printRegisteredCounterInfo(tf); -#endif fprintf(tf,"\n**************************************************\n"); @@ -534,10 +532,9 @@ PrintTickyInfo(void) PR_CTR(GC_WORDS_COPIED_ctr); } -#if 0 /* Data structure used in ``registering'' one of these counters. */ -struct ent_counter *ListOfEntryCtrs = NULL; /* root of list of them */ +struct ent_counter *ticky_entry_ctrs = NULL; /* root of list of them */ /* To print out all the registered-counter info: */ @@ -546,31 +543,22 @@ printRegisteredCounterInfo (FILE *tf) { struct ent_counter *p; - if ( ListOfEntryCtrs != NULL ) { + if ( ticky_entry_ctrs != NULL ) { fprintf(tf,"\n**************************************************\n"); } - for (p = ListOfEntryCtrs; p != NULL; p = p->link) { - /* common stuff first; then the wrapper info if avail */ - fprintf(tf, "%-40s%u\t%u\t%u\t%-16s%ld", + for (p = ticky_entry_ctrs; p != NULL; p = p->link) { + fprintf(tf, "%-40s%u\t%u\t%-16s%ld", p->f_str, p->arity, - p->Astk_args, - p->Bstk_args, + p->stk_args, p->f_arg_kinds, p->ctr); - if ( p->wrap_str == NULL ) { - fprintf(tf, "\n"); + fprintf(tf, "\n"); - } else { - fprintf(tf, "\t%s\t%s\n", - p->wrap_str, - p->wrap_arg_kinds); - } } } -#endif #endif /* TICKY_TICKY */ -- 1.7.10.4