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

Peter Ross pro at missioncriticalit.com
Fri Jun 26 15:52:09 AEST 2009


Hi,

This is useful for users who wish to turn off profiling and turn it back
on when in the profiling grades conditionally and not pay any overhead.


===================================================================


Estimated hours taken: 1
Branches: main

Allow a compile time condition on trace goals whether
or not we are compiling in profiling grade.

compiler/prog_data.m:
compiler/mercury_to_mercury.m:
compiler/simplify.m:
	Add trace_grade_profile and handle it.
	
doc/reference_manual.texi:
	Document that the option exists.


Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.337
diff -u -r1.337 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	11 Jun 2009 08:28:26 -0000	1.337
+++ compiler/mercury_to_mercury.m	26 Jun 2009 05:47:05 -0000
@@ -3245,6 +3245,9 @@
     (
         Grade = trace_grade_debug,
         io.write_string("debug", !IO)
+    ;
+        Grade = trace_grade_profile,
+        io.write_string("profile", !IO)
     ),
     io.write_string(")", !IO).
 mercury_output_trace_compiletime(trace_trace_level(Level), !IO) :-
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.218
diff -u -r1.218 prog_data.m
--- compiler/prog_data.m	11 Jun 2009 08:28:27 -0000	1.218
+++ compiler/prog_data.m	26 Jun 2009 05:47:05 -0000
@@ -1351,7 +1351,8 @@
     ;       trace_trace_level(trace_trace_level).
 
 :- type trace_grade
-    --->    trace_grade_debug.
+    --->    trace_grade_debug
+    ;       trace_grade_profile.
 
 :- type trace_trace_level
     --->    trace_level_shallow
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.240
diff -u -r1.240 simplify.m
--- compiler/simplify.m	19 Jun 2009 07:14:07 -0000	1.240
+++ compiler/simplify.m	26 Jun 2009 05:47:06 -0000
@@ -2058,8 +2058,13 @@
         )
     ;
         Base = trace_grade(Grade),
-        Grade = trace_grade_debug,
-        globals.lookup_bool_option(Globals, exec_trace, Result)
+        (
+            Grade = trace_grade_debug,
+            globals.lookup_bool_option(Globals, exec_trace, Result)
+        ;
+            Grade = trace_grade_profile,
+            globals.lookup_bool_option(Globals, profiling, Result)
+        )
     ;
         Base = trace_trace_level(Level),
         globals.get_trace_level(Globals, TraceLevel),
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.
 (We may support the specification of other kinds of grades in the future.)
 The third has the form @samp{tracelevel(shallow)}, or @samp{tracelevel(deep)};
 this condition is true (irrespective of grade)

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