[m-dev.] for review: deep profiling changes [part 3/3]

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Mar 10 18:27:09 AEDT 2000


On 26-Feb-2000, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> +++ runtime/mercury_wrapper.h	2000/02/25 23:40:17
...
> +#ifdef MR_PROFILE_DEEP
> +extern	MR_Stack_Layout_Entry *program_entry_layout;
> +			/* normally mercury_data__layout__mercury__main_2_0; */
> +#endif

The declaration there should be indended 2 spaces, since it is inside
`#ifdef ...'.

> Index: util/mkinit.c
> +	"#ifdef MR_PROFILE_DEEP\n"
> +	"extern MR_Stack_Layout_Entry mercury_data__layout__%s;\n"
> +	"#endif\n"

Likewise here.

> ===================================================================
> New file: compiler/profiling.m
...
> % Deep profiling is a form of profiling which does not make the assumption 
> % that all calls to a given predicate have equal cost - an assumption made
> % by profilers like prof, gprof, and mprof.  Instead, it records the call
> % tree (collapsed into strongly connected components (SCCs)), and
> % distinguishes each callsite on an SCC-wise basis.

The concept of "SCC" is not clear once you have dynamic binding
(i.e. higher-order and class-method calls).  I think it would be
good to elaborate a bit on what you mean by that here.

> % There are two main kinds of structure associated with the instrumented code:
> %	- SCCIds which are structures which describe a static SCC by
> %	  enumerating the call sites in the procedures that make up the
> %	  SCC. The following information is stored about each call site:
> %		- the caller's MR_Stack_Layout_Entry structure
> %		- the callee's MR_Stack_Layout_Entry structure
> %		- the line number on which the call occurs

I suggest s/line number/source context (i.e. line number)/

> 		% Generate the code fragment the for the epilogue for
> 		% when a procedure succeeds.
> :- pred profiling__success_epilogue(code_tree, code_info, code_info).
> :- mode profiling__success_epilogue(out, in, out) is det.

s/the for the/for the/

> 		% Generate the code fragment the for the epilogue for
> 		% when a procedure fails.
> :- pred profiling__failure_epilogue(code_tree, code_info, code_info).
> :- mode profiling__failure_epilogue(out, in, out) is det.

Likewise.

> 		% Generate the code framgent to update the deep profiling
> 		% pointers before a first order call.
> :- pred profiling__pre_call_update(pred_proc_id, term__context, code_tree,
> 		code_info, code_info).
> :- mode profiling__pre_call_update(in, in, out, in, out) is det.

s/framgent/fragment/

> 		% Generate the code framgent to update the deep profiling
> 		% pointers before a higher order call.
> :- pred profiling__pre_ho_call_update(rval, term__context,
> 		code_tree, code_info, code_info).
> :- mode profiling__pre_ho_call_update(in, in, out, in, out) is det.
>
> 		% Generate the code framgent to update the deep profiling
> 		% pointers after a call.
> :- pred profiling__post_call_update(code_tree, code_info, code_info).
> :- mode profiling__post_call_update(out, in, out) is det.
> 
> 		% Generate the code framgent to update the deep profiling
> 		% pointers when a failure occurs.
> :- pred profiling__post_failure_code(code_tree, code_info, code_info).
> :- mode profiling__post_failure_code(out, in, out) is det.

Likewise in these places.

[... to be continued ...]

P.S. Do you support deep memory profiling?
That would certain be nice, and I suspect it shouldn't be very hard.

-- 
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