[m-rev.] for review: change trace counts file format

Peter Wang wangp at students.cs.mu.OZ.AU
Wed Feb 9 17:14:51 AEDT 2005


Estimated hours taken: 1
Branches: main

This makes the tracing system print out both the defining and declaring
modules of a procedure or function (previously it only printed out the
declaring module).  This fixes a problem where the trace counts reader
would throw an exception on reading some trace count summaries because
it would see two events for what appeared to be the same procedure, but
actually came from different defining modules.

runtime/mercury_trace_base.c:
	Make MR_trace_write_label_exec_counts() print out both the
	defining and declaring modules of a procedure or function.

mdbcomp/trace_counts.m:
	Update the trace counts reader for the new format.


Index: mdbcomp/trace_counts.m
===================================================================
RCS file: /home/mercury1/repository/mercury/mdbcomp/trace_counts.m,v
retrieving revision 1.1
diff -u -r1.1 trace_counts.m
--- mdbcomp/trace_counts.m	28 Jan 2005 07:11:53 -0000	1.1
+++ mdbcomp/trace_counts.m	9 Feb 2005 05:51:23 -0000
@@ -107,19 +107,21 @@
 	(if
 		TokenList =
 			token_cons(name("proc"), _,
+			token_cons(name(DefModuleStr), _,
 			token_cons(name(PredOrFuncStr), _,
-			token_cons(name(ModuleStr), _,
+			token_cons(name(DeclModuleStr), _,
 			token_cons(name(Name), _,
 			token_cons(integer(Arity), _,
 			token_cons(integer(Mode), _,
-			token_nil)))))),
+			token_nil))))))),
 		string_to_pred_or_func(PredOrFuncStr, PredOrFunc)
 	then
-		string_to_sym_name(ModuleStr, ".", ModuleName),
+		string_to_sym_name(DefModuleStr, ".", DefModuleName),
+		string_to_sym_name(DeclModuleStr, ".", DeclModuleName),
 		% At the moment runtime/mercury_trace_base.c doesn't
 		% write out data for 'special' procedures.
-		ProcLabel = proc(ModuleName, PredOrFunc, ModuleName, Name,
-				Arity, Mode),
+		ProcLabel = proc(DefModuleName, PredOrFunc, DeclModuleName,
+				Name, Arity, Mode),
 		% For whatever reason some of the trace counts for a single
 		% procedure or function can be split over multiple spans.
 		% We collate them as if they appeared in a single span.
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.61
diff -u -r1.61 mercury_trace_base.c
--- runtime/mercury_trace_base.c	19 Jan 2005 03:11:22 -0000	1.61
+++ runtime/mercury_trace_base.c	9 Feb 2005 05:50:14 -0000
@@ -255,7 +255,10 @@
                 {
                     id = &proc->MR_sle_user;
                     if (proc != prev_proc) {
-                        fprintf(fp, "proc %c ",
+                        fprintf(fp, "proc ");
+                        MR_trace_write_quoted_atom(fp,
+                            id->MR_user_def_module);
+                        fprintf(fp, " %c ",
                             ( id->MR_user_pred_or_func == MR_PREDICATE
                                 ? 'p' : 'f'));
                         MR_trace_write_quoted_atom(fp,


--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list