This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Per-varray statistics
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 20 Jan 2004 13:34:23 -0800
- Subject: Re: Per-varray statistics
- References: <20040120193549.GS7878@kam.mff.cuni.cz>
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.