[m-dev.] for review: better names for lambda goals

Fergus Henderson fjh at cs.mu.oz.au
Tue Aug 26 16:57:09 AEST 1997


Thomas Charles CONWAY, you wrote:
> Profiling code with lots of lambda goals was painful, because the names
> of the predicates contained no information about which piece of the source
> they correspond to. This change corrects this problem by enabling the
> profiler to produce output such as:
> 
> ... 0.00     0.00 <pred/func goal from lp:'pivot', line 362> [10] 
> ... 0.00     0.00 <pred/func goal from lp:'pivot', line 356> [11] 
> ... 0.00     0.00 <pred/func goal from lp:'simplex', line 262> [12] 

I would prefer
		
	... 0.00     0.00 <pred goal from lp:'simplex', line 262> [12] 
	... 0.00     0.00 <func goal from lp:'pivot', line 356> [11] 

This is easily done, I think.  See below.

> profiler/demangle.m:
> 	demangle the names for lambda goals.

You also need to change util/mdemangle.c.

>  	%
> +	% Now we need to look at the pred name and see if it is an
> +	% introduced lambda predicate.
> +	%
> +
> +	=(PredName0),
> +
> +	( remove_prefix("IntroducedFrom__") ->
> +		( remove_prefix("pred__") ->
> +			[]
> +		; remove_prefix("func__")
> +		),
> +		remove_maybe_module_prefix(MPredName),
> +		{ MPredName = yes(PredName) },
> +		remove_int(Line),
> +		{ Category = lambda(Line) }

Replace that with
		( remove_prefix("pred__") ->
			{ LambdaPredOrFunc = "pred" }
		; remove_prefix("func__") ->
			{ LambdaPredOrFunc = "func" }
		;
			{ fail }
		),
		remove_maybe_module_prefix(MPredName),
		{ MPredName = yes(PredName) },
		remove_int(Line),
		{ Category = lambda(Line, LambdaPredOrFunc) }

> +	;
> +		Category = lambda(Line),
> +		string__format("pred/func goal from %s, line %d",
> +			[s(QualifiedName), i(Line)], MainPart)

		Category = lambda(Line, LambdaPredOrFunc),
		string__format("%s goal from %s, line %d",
			[s(LambdaPredOrFunc), s(QualifiedName), i(Line)],
			MainPart)
-- 
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