[m-rev.] for review: fix misleading io__report_stats
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Apr 30 21:51:47 AEST 2001
On 30-Apr-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 26-Apr-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > runtime/mercury_wrapper.[ch]:
> > > Add a global variable that records the size of the zones allocated
> > > via Boehm gc since the last call to io__report_stats.
> > >
> > > runtime/mercury_memory_zones.c:
> > > Increment this global variable as appropriate.
> > >
> > > library/benchmarking.m:
> > > Subtract the global variable from the value reported for heap cell
> > > allocations, then zero it to prevent double counting.
> >
> > This fix doesn't work, I'm pretty sure. E.g. it will do the wrong thing for
> >
> > main -->
> > io__report_stats,
> > io__report_stats.
> >
> > and for
> >
> > main -->
> > gc__garbage_collect,
> > io__report_stats.
>
> Why? What wrong thing do you think it will do?
Calling io__report_stats twice in a row shoud give the same
answer for "heap allocated since last GC", but because you
zero the global variable in report_stats, it won't.
Calling io__report_stats after gc__garbage_collect should report zero for
"heap allocated since last GC", but because you subtract the global
variable, I think it will report something negative (probably wrapped
around mod 2^32 or 2^64, since it is using unsigned arithmetic, I think).
--
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