This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: Per-varray statistics


Jan Hubicka <jh@suse.cz> writes:

> Hi,
> as discussed earlier, this patch implements the statistics about each
> varray so we know the worst offenders to shot first.
> 
> Honza
> 
> 	* varray.c:  Include hashtab.h

You forgot to update Makefile.in.

> 	(varray_descriptor): New structure.
> 	(hash_descriptor, eq_descriptor, varray_descriptor,
> 	print_statistics): New static functions
> 	(varray_init, varray_grow): Update statistics
> 	(dump_varray_statistics): New function.
> 	* varray.h (dump_varray_statistics): Declare.
> 	* toplev.c (finalize): Call it.
> + /* Output per-varray statistics.  */
> + #ifdef GATHER_STATISTICS
> + struct output_info
> + {
> +   int count;
> +   int size;
> + };
> + static int
> + print_statistics (void **slot, void *b)
> + {
> +   struct varray_descriptor *d = (struct varray_descriptor *) *slot;
> +   struct output_info *i = (struct output_info *) b;
> + 
> +   if (d->allocated)
> +     {
> +       fprintf (stderr, "%-21s %6d %10d %7d %7d\n", d->name,
> + 	       d->created, d->allocated, d->resized, d->copied);
> +       i->size += d->allocated;
> +       i->count += d->created;
> +     }
> +   return 1;
> + }
> + #endif
> + void dump_varray_statistics (void)
> + {
> + #ifdef GATHER_STATISTICS
> +   struct output_info info;
> + 
> +   fprintf (stderr, "\nVARRAY Kind            Count      Bytes  Resized copied\n");
> +   fprintf (stderr, "-------------------------------------------------------\n");
> +   info.count = 0;
> +   info.size = 0;
> +   htab_traverse (varray_hash, print_statistics, &info);
> +   fprintf (stderr, "-------------------------------------------------------\n");
> +   fprintf (stderr, "%-20s %7d %10d\n",
> + 	   "Total", info.count, info.size);
> +   fprintf (stderr, "-------------------------------------------------------\n");
> + #endif
> + }

I think this could use a few blank lines; and comments.

Otherwise OK.


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