[m-dev.] for review: enhancement for profiling

Fergus Henderson fjh at cs.mu.oz.au
Tue Jul 22 17:29:26 AEST 1997


Thomas Charles CONWAY, you wrote:
> 
> Enhance the runtime support for profiling so that the profiling data
> gets written out if the program terminates through a call to exit
> rather than by main terminating. This enables profiling to work with
> the Tcl/Tk and OpenGL stuff (for example).
> 
> runtime/prof.c
> 	Register a function for writing out profiling info with atexit.
> 	Make the functions for writing out the profiling info check to
> 	see if it has been written out yet, and return straight away if
> 	it has.

> --- prof.c	1997/02/12 02:16:08	1.29
> +++ prof.c	1997/07/21 04:32:03
> @@ -101,12 +101,20 @@
>  #ifdef PROFILE_CALLS
>  static	FILE	 	*declfptr = NULL;
>  static	prof_call_node	*addr_pair_table[CALL_TABLE_SIZE] = {NULL};
> +static	bool		addr_pair_table_written = FALSE;

Could this be a function-local static variable rather than a global
static variable?

> +static	bool		addr_table_written = FALSE;

Ditto.

> +	if (atexit(func) != 0) {
> +		fprintf(stderr,
> +			"Mercury runtime: error in call to atexit %s\n",
> +			strerror(errno));

s/atexit %s/atexit: %s/

Otherwise that looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list