This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc 3.3 garbage collector defaults


Matt Austern wrote:
> 
> That's quite possible, but I hope we can focus on the things
> that *have* changed between 3.2 and 3.3.
> 
> When I compare 3.2 and 3.3 on the same file and the same
> machine, 3.3 is much slower than 3.2 and a good part of the
> extra time, according to -ftime-report, is from the gc.  If
> those measurements are right (and I think they probably are,
> since several other people report similar results), then
> there aren't a whole lot of possibilities for what caused
> the regression.  We now know it wasn't the gc parameters.
> What possibilities haven't we ruled out yet?

Try the attached (old, may not apply cleanly) patch and see if
any pass allocates heaps more memory in 3.3 than it used to in
3.2?


Segher


--- /home/segher/gcc/gcc-20020805/gcc/timevar.c	Fri Nov 16 03:36:39 2001
+++ ./timevar.c	Mon Aug 19 18:20:56 2002
@@ -24,6 +24,8 @@
 #include "intl.h"
 #include "rtl.h"
 
+extern HOST_WIDE_INT ggc_total_allocated;
+
 #ifdef HAVE_SYS_TIMES_H
 # include <sys/times.h>
 #endif
@@ -186,6 +188,8 @@
   now->sys  = 0;
   now->wall = 0;
 
+  now->alloc = 0;
+
   if (!TIMEVAR_ENABLE)
     return;
 
@@ -206,6 +210,8 @@
     now->user = clock () * clocks_to_msec;
 #endif
   }
+
+  now->alloc = ggc_total_allocated;
 }
 
 /* Add the difference between STOP_TIME and START_TIME to TIMER.  */
@@ -219,6 +225,8 @@
   timer->user += stop_time->user - start_time->user;
   timer->sys += stop_time->sys - start_time->sys;
   timer->wall += stop_time->wall - start_time->wall;
+
+  timer->alloc += stop_time->alloc - start_time->alloc;
 }
 
 /* Initialize timing variables.  */
@@ -464,7 +472,8 @@
          zeroes.  */
       if (tv->elapsed.user < tiny
 	  && tv->elapsed.sys < tiny
-	  && tv->elapsed.wall < tiny)
+	  && tv->elapsed.wall < tiny
+	  && tv->elapsed.alloc < tiny * 1048576)
 	continue;
 
       /* The timing variable name.  */
@@ -491,6 +500,11 @@
 	       (total->wall == 0 ? 0 : tv->elapsed.wall / total->wall) * 100);
 #endif /* HAVE_WALL_TIME */
 
+      /* Print Megabytes allocated in GC memory.  */
+      fprintf(fp, "%7.2f (%2.0f%%) alloc",
+	      tv->elapsed.alloc / 1048576.,
+	      (total->alloc == 0 ? 0 : (double)tv->elapsed.alloc / total->alloc) * 100);
+
       putc ('\n', fp);
     }
 
@@ -503,9 +517,10 @@
   fprintf (fp, "%7.2f          ", total->sys);
 #endif
 #ifdef HAVE_WALL_TIME
-  fprintf (fp, "%7.2f\n", total->wall);
+  fprintf (fp, "%7.2f           ", total->wall);
 #endif
-  
+  fprintf (fp, "%7.2f\n", total->alloc / 1048576.);
+
 #endif /* defined (HAVE_USER_TIME) || defined (HAVE_SYS_TIME) 
 	  || defined (HAVE_WALL_TIME) */
 }
--- /home/segher/gcc/gcc-20020805/gcc/timevar.h	Tue Oct 30 00:01:45 2001
+++ ./timevar.h	Mon Aug 19 16:49:12 2002
@@ -61,6 +61,9 @@
 
   /* Wall clock time.  */
   float wall;
+
+  /* GC allocated bytes.  */
+  HOST_WIDE_INT alloc;
 };
 
 /* An enumeration of timing variable identifiers.  Constructed from
--- /home/segher/gcc/gcc-20020805/gcc/ggc-page.c	Sat Jan  5 23:11:21 2002
+++ ./ggc-page.c	Mon Aug 19 20:59:59 2002
@@ -335,6 +335,8 @@
   FILE *debug_file;
 } G;
 
+HOST_WIDE_INT ggc_total_allocated;
+
 /* The size in bytes required to maintain a bitmap for the objects
    on a page-entry.  */
 #define BITMAP_SIZE(Num_objects) \
@@ -952,6 +954,7 @@
   /* Keep track of how many bytes are being allocated.  This
      information is used in deciding when to collect.  */
   G.allocated += OBJECT_SIZE (order);
+  ggc_total_allocated += size;
 
   if (GGC_DEBUG_LEVEL >= 3)
     fprintf (G.debug_file, 
@@ -1046,6 +1049,8 @@
 init_ggc ()
 {
   unsigned order;
+
+  ggc_total_allocated = 0;
 
   G.pagesize = getpagesize();
   G.lg_pagesize = exact_log2 (G.pagesize);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]