[m-rev.] review: add a profiling grade compile time switch for trace goals

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Jun 29 16:44:16 AEST 2009


On Mon, 29 Jun 2009, Peter Ross wrote:

>>> Index: doc/reference_manual.texi
>>> ===================================================================
>>> RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
>>> retrieving revision 1.431
>>> diff -u -r1.431 reference_manual.texi
>>> --- doc/reference_manual.texi   10 Mar 2009 05:00:32 -0000      1.431
>>> +++ doc/reference_manual.texi   26 Jun 2009 05:47:08 -0000
>>> @@ -9473,9 +9473,9 @@
>>> where @var{FlagName} is an arbitrary name picked by the programmer;
>>> this condition is true
>>> if the module is compiled with the option
>>> @samp{--trace-flag=@var{FlagName}}.
>>> -The second has the form @samp{grade(debug)};
>>> +The second has the form @samp{grade(debug)} or @samp{grade(profile)};
>>> this condition is true
>>> -if the module is compiled in a debugging grade.
>>> +if the module is compiled in a debugging or profiling (not deep
>>> profiling) grade.
>>
>> Also, not memory profiling (.memprof) or did you intend that be covered
>> by the grade(profile) condition?
>>
> Yes I intended memory profiling grades to be covered as well by the condition.
>
> Is my code incorrect?

According to compiler/options.m,

 	profiling           % profile_time + profile_calls

Using the value of the profiling option to evaluate the trace goal
condition won't cover memory profiling.  I think what you need is
something like the following in simplify.m:

 	(
 		Grade = trace_grade_debug,
 		globals.lookup_bool_option(Globals, exec_trace, Result)
 	;
 		Grade = trace_grade_profile,
 		globals.lookup_bool_option(Globals, profiling,
 			ProfResult),
 		globals.lookup_bool_option(Globals, memory_profiling,
 			MemProfResult),
 		Reslut = ProfResult `bool.or` MemProfResult
 	)

I think the reference manual entry should explicitly mention that memory
profiling is covered as well.

Julien.


More information about the reviews mailing list