[m-dev.] for review: The first bit of deep profiling

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Sep 13 13:11:36 AEST 1999


On 13-Sep-1999, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> 
> Index: compiler/handle_options.m
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/compiler/handle_options.m,v
> retrieving revision 1.77
> diff -u -r1.77 handle_options.m
> --- handle_options.m	1999/08/13 01:42:59	1.77
> +++ handle_options.m	1999/08/27 00:20:17
> @@ -356,6 +356,15 @@
>  		[]
>  	),
>  
> +	% Deep profiling requires `procid' stack layouts
> +	globals__io_lookup_bool_option(profile_deep, DeepProfiling),
> +	(
> +		{ DeepProfiling = yes },
> +		globals__io_set_option(procid_stack_layout, bool(yes))
> +	;
> +		{ DeepProfiling = no }
> +	),

I think you could write that more simply as

	% Deep profiling requires `procid' stack layouts
	option_implies(profile_deep, procid_stack_layout, bool(yes)),

> --- options.m	1999/08/13 01:43:07	1.267
> +++ options.m	1999/08/27 00:20:27
> @@ -1099,6 +1105,9 @@
>  	map__set(OptionTable0, profile_time, bool(no), OptionTable1),
>  	map__set(OptionTable1, profile_calls, bool(yes), OptionTable2),
>          map__set(OptionTable2, profile_memory, bool(yes), OptionTable).
> +special_handler(deep_profiling, none, OptionTable0, ok(OptionTable)) :-
> +	map__set(OptionTable0, profile_time, bool(no), OptionTable1),
> +	map__set(OptionTable1, profile_deep, bool(yes), OptionTable).

Shouldn't the `bool(no)' here be `bool(yes)'?

Also, for consistency with the way the other --foo-profiling options are
handled, and with the way that the --deep-profiling option is handled in
scripts/parse_grade_options.sh-subr, you should set `profile_calls'
and `profile_memory' to `bool(no)' here.  Likewise the special_handlers for
memory_profiling, call_profiling, and time_profiling should set
`profile_deep' to `bool(no)'.

Apart from that, it looks fine.

(I notice that the new options are not yet documented, but I presume
that will come as part of a later change?)

Cheers,
	Fergus.

-- 
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.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list