[m-rev.] [reuse] diff: cell cache statistics
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Mar 19 18:31:18 AEDT 2001
On 19-Mar-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> Hi,
> --- compiler/mlds_to_c.m 2001/03/18 16:56:51 1.55.2.9
> +++ compiler/mlds_to_c.m 2001/03/19 06:19:12
> @@ -2390,15 +2390,13 @@
> %
> % heap management
> %
> -mlds_output_atomic_stmt(_Indent, _FuncInfo, delete_object(_Lval, _Size), _) -->
> - [].
> - % Commented out until MR_compile_time_gc implemented.
> - % mlds_indent(Indent),
> - % io__write_string("MR_compile_time_gc(MR_strip_tag("),
> - % mlds_output_lval(Lval),
> - % io__write_string("), "),
> - % io__write_int(Size),
> - % io__write_string(");\n").
> +mlds_output_atomic_stmt(Indent, _FuncInfo, delete_object(Lval, Size), _) -->
> + mlds_indent(Indent),
> + io__write_string("MR_compile_time_gc(MR_strip_tag("),
> + mlds_output_lval(Lval),
> + io__write_string("), "),
> + io__write_int(Size),
> + io__write_string(");\n").
It would be better to put the strip_tag in the lval during
code generation, if it is needed, rather than always adding it here.
> Index: library/benchmarking.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/benchmarking.m,v
> retrieving revision 1.34.4.3
> diff -u -r1.34.4.3 benchmarking.m
> --- library/benchmarking.m 2001/03/18 17:45:08 1.34.4.3
> +++ library/benchmarking.m 2001/03/19 06:19:27
> @@ -259,6 +259,11 @@
>
> #endif /* PROFILE_MEMORY */
>
> + /*
> + ** Cell cache statistics.
> + */
> + MR_output_cell_cache_stats();
> +
> fprintf(stderr, ""]\\n"");
> }
That should not be done unconditionally.
It should be inside some #ifdef.
> Index: runtime/mercury_memory.c
> +void MR_compile_time_gc(MR_Word cell, size_t size)
> +{
> + if (size <= MR_MAX_CACHED_CELL_SIZE) {
> + record_stats(size);
> + }
> +}
> +
> +void MR_update_cell_cache_statistics(size_t size)
> +{
> + if (size <= MR_MAX_CACHED_CELL_SIZE) {
> + stats[size].sum_length += stats[size].length;
> +
> + if (stats[size].length == 0) {
> + stats[size].misses++;
> + } else {
> + stats[size].length--;
> + stats[size].hits++;
> + }
> + }
> +}
It would be much nicer to put all the stats which
don't fit in the last bucket, rather than just
discarding them. i.e.
int bucket = max(size, MR_MAX_CACHED_CELL_SIZE);
record_stats(bucket);
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list