[m-dev.] [reuse] diff: more information in profiling-output-graph

Nancy Mazur Nancy.Mazur at cs.kuleuven.ac.be
Fri Oct 27 03:09:39 AEDT 2000


Hi,


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


Estimated hours taken: 1

Put some more information in the .profile file and reorient the graph. 
Using different colors and styles of boxes for different purposes. 
Legend:

Style:  - double box = exported predicate
	- single ellips = local predicate
	- double ellips = none of the above
Color:  - green = unconditional reuse
	- red = conditional reuse
	- mistyrose = no reuse, but the procedure has a reuse-version. 

sr_profile.m:
	Adjust output to give more information about each of the predicates. 
	Also a change in the direction of the final graph (left-right, 
	instead of top-bottom).


Index: sr_profile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_profile.m,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 sr_profile.m
--- sr_profile.m	2000/10/23 14:41:22	1.1.2.2
+++ sr_profile.m	2000/10/26 16:03:07
@@ -74,7 +74,7 @@
 
 :- implementation. 
 
-:- import_module bool, relation, require, set, time, list, std_util. 
+:- import_module bool, relation, require, set, time, list, std_util, map. 
 :- import_module dependency_graph, hlds_out, hlds_pred.
 
 init( P ) :- 
@@ -192,7 +192,7 @@
 
 		io__write_string( Stream, "*/\ndigraph "),
 		io__write_string(Stream, String), 
-		io__write_string(Stream, " {\n"),
+		io__write_string(Stream, " {\nrankdir=LR;\n"),
 		{ dependency_graph__build_dependency_graph(HLDS,
 				no, DepInfo) },
 		{ hlds_dependency_info_get_dependency_graph(DepInfo,
@@ -235,20 +235,61 @@
 		pred_proc_id::in, io__state::di, io__state::uo) is det.
 
 write_procedure_node(HLDS, Stream, PredProcId) -->
+	{ module_info_structure_reuse_info(HLDS, HLDSReuseInfo) },
+	{ HLDSReuseInfo = structure_reuse_info( ReuseMap ) }, 
 	io__set_output_stream(Stream, OldStream),
 	{ PredProcId = proc(PredId, ProcId) },
-	{ module_info_pred_proc_info(HLDS, PredProcId, _PredInfo, ProcInfo) },
+	{ module_info_pred_proc_info(HLDS, PredProcId, PredInfo, ProcInfo) },
 	{ proc_info_reuse_information(ProcInfo, ReuseInfo) },
+	{ pred_info_import_status(PredInfo, ImportStatus) }, 
 
+	{ 
+	( 
+		ImportStatus = exported
+	->
+		Shape = "box", 
+		Periferies = "2"
+	;
+		ImportStatus = local
+	->
+		Shape = "ellipse",
+		Periferies = "1"
+	;
+		Shape = "ellipse", 
+		Periferies = "2"
+	), 
+
+	(
+		ReuseInfo = yes(Conds)
+	->
+		(
+			Conds = [],
+			Color = "style=filled, color=chartreuse2"
+		;
+			Conds = [_|_],
+			Color = "style=filled, color=tomato"
+		)
+	;
+		(
+			map__contains(ReuseMap, PredProcId)
+		->
+			% meaning: the predproc has a reuse version
+			% but is not used here. 
+			Color = "style=filled, color=mistyrose"
+		;
+			Color = "color=black"
+		)
+	) },
+	{ string__append_list( ["[", Color,
+				",shape=",Shape,
+				",peripheries=", Periferies, "];\n"], 
+				Options ) }, 
+
 	io__write_char('"'),
 	hlds_out__write_pred_proc_id(HLDS, PredId, ProcId),
 	io__write_char('"'),
 
-	( { ReuseInfo = yes(_) } ->
-		io__write_string(" [style=filled,color=red,shape=box];\n")
-	;
-		io__write_string(";\n")
-	),
+	io__write_string(Options), 
 
 	io__set_output_stream(OldStream, _).
 

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