[project @ 2000-08-07 16:06:38 by rrt]
[ghc-hetmet.git] / ghc / rts / Ticky.c
index d059808..c8ccdbb 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Ticky.c,v 1.7 1999/05/11 16:49:44 keithw Exp $
+ * $Id: Ticky.c,v 1.12 1999/11/11 17:50:48 simonpj Exp $
  *
  * (c) The AQUA project, Glasgow University, 1992-1997
  * (c) The GHC Team, 1998-1999
@@ -81,9 +81,10 @@ PrintTickyInfo(void)
 
   unsigned long tot_returns_of_new = RET_NEW_ctr;
 
+  unsigned long con_updates = UPD_CON_IN_NEW_ctr + UPD_CON_IN_PLACE_ctr;
   unsigned long pap_updates = UPD_PAP_IN_NEW_ctr + UPD_PAP_IN_PLACE_ctr;
 
-  unsigned long tot_updates = UPD_EXISTING_ctr + UPD_SQUEEZED_ctr + pap_updates;
+  unsigned long tot_updates = UPD_SQUEEZED_ctr + pap_updates + con_updates;
 
   unsigned long tot_new_updates   = UPD_NEW_IND_ctr + UPD_NEW_PERM_IND_ctr;
   unsigned long tot_old_updates   = UPD_OLD_IND_ctr + UPD_OLD_PERM_IND_ctr;
@@ -241,30 +242,33 @@ PrintTickyInfo(void)
        UPDF_RCC_OMITTED_ctr);
 
   fprintf(tf,"\nUPDATES: %ld\n", tot_updates);
-  fprintf(tf,"%7ld (%5.1f%%) data values\n",
-       UPD_CON_IN_NEW_ctr,
-       PC(INTAVG(UPD_CON_IN_NEW_ctr,tot_updates)));
+  fprintf(tf,"%7ld (%5.1f%%) data values\n\t\t  [%ld in place, %ld allocated new space]\n",
+       con_updates,
+       PC(INTAVG(con_updates,tot_updates)),
+       UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr);
   fprintf(tf,"%7ld (%5.1f%%) partial applications\n\t\t  [%ld in place, %ld allocated new space]\n",
        pap_updates,
        PC(INTAVG(pap_updates,tot_updates)),
        UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr);
-  fprintf(tf,"%7ld (%5.1f%%) updates to existing heap objects (%ld by squeezing)\n",
-       UPD_EXISTING_ctr + UPD_SQUEEZED_ctr,
-       PC(INTAVG(UPD_EXISTING_ctr + UPD_SQUEEZED_ctr, tot_updates)),
-       UPD_SQUEEZED_ctr);
+  fprintf(tf,"%7ld (%5.1f%%) updates by squeezing\n",
+       UPD_SQUEEZED_ctr,
+       PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates)));
 
-  fprintf(tf, "UPD_CON_IN_NEW:   %7ld: ", UPD_CON_IN_NEW_ctr);
+  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");
+  fprintf(tf, "UPD_CON_IN_PLACE: %7ld: ", UPD_CON_IN_PLACE_ctr);
+  for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_PLACE_hst[i]); }
+  fprintf(tf, "\n");
   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");
 
   if (tot_gengc_updates != 0) {
-      fprintf(tf,"\nNEW GEN UPDATES: %ld (%5.1f%%)\n",
+      fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n",
              tot_new_updates,
              PC(INTAVG(tot_new_updates,tot_gengc_updates)));
-      fprintf(tf,"\nOLD GEN UPDATES: %ld (%5.1f%%)\n",
+      fprintf(tf,"OLD GEN UPDATES: %9ld (%5.1f%%)\n",
              tot_old_updates,
              PC(INTAVG(tot_old_updates,tot_gengc_updates)));
   }
@@ -272,9 +276,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");
 
@@ -490,9 +492,9 @@ PrintTickyInfo(void)
   PR_CTR(UPDF_RCC_PUSHED_ctr);
   PR_CTR(UPDF_RCC_OMITTED_ctr);
 
-  PR_CTR(UPD_EXISTING_ctr);
   PR_CTR(UPD_SQUEEZED_ctr);
   PR_CTR(UPD_CON_IN_NEW_ctr);
+  PR_CTR(UPD_CON_IN_PLACE_ctr);
   PR_CTR(UPD_PAP_IN_NEW_ctr);
   PR_CTR(UPD_PAP_IN_PLACE_ctr);
 
@@ -534,43 +536,47 @@ 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 */
+StgEntCounter *ticky_entry_ctrs = NULL; /* root of list of them */
 
 /* To print out all the registered-counter info: */
 
 static void
 printRegisteredCounterInfo (FILE *tf)
 {
-    struct ent_counter *p;
+    StgEntCounter *p;
 
-    if ( ListOfEntryCtrs != NULL ) {
-       fprintf(tf,"\n**************************************************\n");
+    if ( ticky_entry_ctrs != NULL ) {
+      fprintf(tf,"\n**************************************************\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",
-               p->f_str,
+    fprintf(tf, "%11s%11s%11s %6s%6s    %-11s%-30s\n",
+           "Entries", "Slow ent", "Allocs", "Arity", "Stack", "Kinds", "Function");
+    fprintf(tf, "--------------------------------------------------------------------------------\n");
+    /* 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%11ld %6u%6u    %-11s%-30s",
+               p->entry_count,
+               p->slow_entry_count,
+               p->allocs,
                p->arity,
-               p->Astk_args,
-               p->Bstk_args,
-               p->f_arg_kinds,
-               p->ctr);
-
-       if ( p->wrap_str == NULL ) {
-           fprintf(tf, "\n");
-
-       } else {
-           fprintf(tf, "\t%s\t%s\n",
-               p->wrap_str,
-               p->wrap_arg_kinds);
-       }
+               p->stk_args,
+               p->arg_kinds,
+               p->str);
+
+       fprintf(tf, "\n");
+
     }
 }
-#endif
+
+/* Catch-all top-level counter struct.  Allocations from CAFs will go
+ * here.
+ */
+StgEntCounter top_ct
+       = { 0, 0, 0,
+           "TOP", "",
+           0, 0, 0, NULL };
 
 #endif /* TICKY_TICKY */