[m-rev.] for review: fix bugs in runtime support of deep profiling

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Oct 11 16:48:40 AEST 2006


On Wed, 11 Oct 2006, Zoltan Somogyi wrote:

> Fix three bugs in the runtime system's support for deep profiling.

...

> runtime/mercury_deep_*_port_body.h:
> 	The second bug was that we collected the wrong sort of call sequence
> 	number information. We tried to define the call sequence number field
> 	(MR_own_call_seqs) of call dynamic structures to make them contain,
> 	for each call, a number proportional to the time from the start of
> 	the call to the end of the call. The problems with this is that
> 	all the other cost measure fields of the call site structure
> 	(time quanta, number of memory allocations, number of words allocated)
> 	were non-cumulative; e.g. the time quanta field was incremented only
> 	when a clock interrupt happened inside the code of the called
> 	predicate, not in its descendants. Propagating the costs of
> 	descendants to the ancestors is the deep profiler's job. By including
> 	the cost of descendants in the MR_own_call_seqs field, the propagation
> 	algorithm of the deep profiler actually screws up the call sequence
> 	number information, by including the cost of descendants twice.
> 	We could modify the propagation algorithm to avoid double-propagating
> 	call sequence number information, but it would be a significant coding
> 	job.
>
> 	The much simpler fix is to treat the increment of the call sequence
> 	number the same way we handle a profiling interrupt: we increment
> 	the relevant field of the current call site dynamic structure.

...

> Index: runtime/mercury_deep_leave_port_body.h
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_leave_port_body.h,v
> retrieving revision 1.5
> diff -u -r1.5 mercury_deep_leave_port_body.h
> --- runtime/mercury_deep_leave_port_body.h	4 Oct 2006 06:59:23 -0000	1.5
> +++ runtime/mercury_deep_leave_port_body.h	10 Oct 2006 09:43:46 -0000
> @@ -58,10 +58,6 @@
>     #endif
>   #endif
>
> -  #ifdef MR_DEEP_PROFILING_CALL_SEQ
> -	csd->MR_csd_own.MR_own_call_seqs += MR_deep_prof_cur_call_seq;
> -  #endif
> -
> 	MR_deep_assert(csd, NULL, NULL, csd->MR_csd_callee_ptr != NULL);
> 	pl = csd->MR_csd_callee_ptr->MR_pd_proc_layout;
> 	MR_deep_assert(csd, pl, NULL, pl != NULL);

You need also need to update the code that updates the procedure call
counts in library/exception.m to conform to the new way of counting them.

Otherwise that looks okay.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list