[m-rev.] for review: fix misleading io__report_stats

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Apr 26 19:01:24 AEST 2001


For review by anyone.

Fix a bug: in .gc grades, io__report_stats reported the size of the stacks
(and possibly other zones) allocated at program startup as if they were cells
allocated on the heap.

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.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing library
Index: library/benchmarking.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/benchmarking.m,v
retrieving revision 1.40
diff -u -b -r1.40 benchmarking.m
--- library/benchmarking.m	2001/03/15 07:42:21	1.40
+++ library/benchmarking.m	2001/04/26 07:25:48
@@ -211,9 +211,10 @@
 		""\\n#GCs: %lu, ""
 		""Heap used since last GC: %.3fk, Total used: %.3fk"",
 		(unsigned long) GC_gc_no,
-		GC_get_bytes_since_gc() / 1024.0,
+		(GC_get_bytes_since_gc() - MR_nonheap_gc_bytes) / 1024.0,
 		GC_get_heap_size() / 1024.0
 	);
+	MR_nonheap_gc_bytes = 0;
 #else
 	fprintf(stderr, 
 		""\\nHeap: %.3fk"",
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_memory_zones.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_zones.c,v
retrieving revision 1.16
diff -u -b -r1.16 mercury_memory_zones.c
--- runtime/mercury_memory_zones.c	2001/03/13 18:02:26	1.16
+++ runtime/mercury_memory_zones.c	2001/04/26 07:24:58
@@ -136,7 +136,14 @@
 	return ptr;
 }
 #elif defined(CONSERVATIVE_GC)
-  #define	memalign(a,s)   GC_MALLOC_UNCOLLECTABLE(s)
+  #define	memalign(a,s)   MR_memalign_conservative(a, s)
+
+static void *
+MR_memalign_conservative(size_t unit, size_t size)
+{
+	MR_nonheap_gc_bytes += size;
+	return GC_MALLOC_UNCOLLECTABLE(size);
+}
 #elif defined(HAVE_MEMALIGN)
   extern void	*memalign(size_t, size_t);
 #else
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.88
diff -u -b -r1.88 mercury_wrapper.c
--- runtime/mercury_wrapper.c	2001/04/16 09:50:27	1.88
+++ runtime/mercury_wrapper.c	2001/04/26 07:24:17
@@ -78,6 +78,8 @@
 size_t		MR_generatorstack_zone_size =	  16;
 size_t		MR_cutstack_zone_size =		  16;
 
+size_t		MR_nonheap_gc_bytes =		  0;
+
 /* primary cache size to optimize for, in bytes */
 size_t		MR_pcache_size =	        8192;
 
Index: runtime/mercury_wrapper.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.h,v
retrieving revision 1.42
diff -u -b -r1.42 mercury_wrapper.h
--- runtime/mercury_wrapper.h	2001/01/18 01:19:10	1.42
+++ runtime/mercury_wrapper.h	2001/04/26 07:24:27
@@ -187,6 +187,10 @@
 extern	size_t		MR_generatorstack_zone_size;
 extern	size_t		MR_cutstack_zone_size;
 
+/* number of bytes allocated with boehm gc that is *not* for heap cells, */
+/* e.g. for the stack zones; for use by library/benchmarking.m */
+extern	size_t		MR_nonheap_gc_bytes;
+
 /* file names for the mdb debugging streams */
 extern	const char	*MR_mdb_in_filename;
 extern	const char	*MR_mdb_out_filename;
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
--------------------------------------------------------------------------
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