[MLton-devel] cvs commit: -profile-combine {false|true}

Stephen Weeks MLton@mlton.org
Mon, 10 Feb 2003 19:51:27 -0800


sweeks      03/02/10 19:51:26

  Modified:    doc      changelog
               man      mlton.1
               mlton/backend profile.fun
               mlton/control control.sig control.sml
               mlton/main main.sml
  Log:
  Added -profile-combine {false|true} option to mlton.  This lets one
  achieve the old behavior of combining all duplicates of a function
  into a single node.  I first tried to do this as a switch to mlprof,
  but then learned the hard way that that can't work, at least with
  -profile-stack true, since there is no reasonable way to combine stack
  counts (two different copies of a function may be on the stack
  simultaneously, or may not).

Revision  Changes    Path
1.17      +3 -0      mlton/doc/changelog

Index: changelog
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/changelog,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- changelog	10 Feb 2003 00:23:15 -0000	1.16
+++ changelog	11 Feb 2003 03:51:25 -0000	1.17
@@ -1,5 +1,8 @@
 Here are the changes from version 20020923.
 
+* 2003-02-10
+  - Added option to mlton: -profile-combine {false|true}
+
 * 2003-02-09
   - Added options to mlprof: -graph-title, -gray, -ignore, -mlmon,
 	-tolerant.



1.25      +5 -0      mlton/man/mlton.1

Index: mlton.1
===================================================================
RCS file: /cvsroot/mlton/mlton/man/mlton.1,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- mlton.1	10 Feb 2003 19:37:38 -0000	1.24
+++ mlton.1	11 Feb 2003 03:51:25 -0000	1.25
@@ -130,6 +130,11 @@
 extract information from this file. 
 
 .TP
+\fB-profile-combine \fI{\fBfalse\fP|\fBtrue\fP}\fR
+When \fBtrue\fP, combine all copies of each function together for
+profiling data and for the call graph.
+
+.TP
 \fB-profile-stack \fI{\fBfalse\fP|\fBtrue\fP}\fR
 If true, the profiler will count the time spent (or bytes allocated)
 while a function is on the stack.



1.24      +7 -2      mlton/mlton/backend/profile.fun

Index: profile.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/backend/profile.fun,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- profile.fun	9 Feb 2003 22:48:35 -0000	1.23
+++ profile.fun	11 Feb 2003 03:51:25 -0000	1.24
@@ -101,8 +101,7 @@
       val infoNodes: InfoNode.t list ref = ref []
       local
 	 val c = Counter.new 0
-      in
-	 fun sourceInfoNode si =
+	 fun new si =
 	    let
 	       val index = Counter.next c
 	       val infoNode = InfoNode.T {index = index,
@@ -112,6 +111,12 @@
 	    in
 	       infoNode
 	    end
+      in	 
+	 val sourceInfoNode =
+	    if !Control.profileCoalesce
+	       then
+		  #get (Property.get (SourceInfo.plist, Property.initFun new))
+	    else new
       end
       fun firstEnter (ps: Push.t list): InfoNode.t option =
 	 List.peekMap (ps, fn p =>



1.67      +2 -0      mlton/mlton/control/control.sig

Index: control.sig
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/control/control.sig,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- control.sig	2 Feb 2003 03:17:08 -0000	1.66
+++ control.sig	11 Feb 2003 03:51:25 -0000	1.67
@@ -198,6 +198,8 @@
 
       val profileBasis: bool ref
 
+      val profileCoalesce: bool ref
+
       datatype profileIL = ProfileSSA | ProfileSource
       val profileIL: profileIL ref
 	 



1.83      +4 -0      mlton/mlton/control/control.sml

Index: control.sml
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/control/control.sml,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- control.sml	2 Feb 2003 03:17:08 -0000	1.82
+++ control.sml	11 Feb 2003 03:51:26 -0000	1.83
@@ -370,6 +370,10 @@
 			    default = false,
 			    toString = Bool.toString}
 
+val profileCoalesce = control {name = "profile coalesce",
+			       default = false,
+			       toString = Bool.toString}
+
 datatype profileIL = datatype ProfileIL.t
    
 val profileIL = control {name = "profile IL",



1.121     +4 -1      mlton/mlton/main/main.sml

Index: main.sml
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/main/main.sml,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- main.sml	11 Feb 2003 02:11:50 -0000	1.120
+++ main.sml	11 Feb 2003 03:51:26 -0000	1.121
@@ -272,6 +272,9 @@
        (Expert, "profile-basis", " {false|true}",
 	"profile the basis implementation",
 	boolRef profileBasis),
+       (Normal, "profile-combine", " {false|true}",
+	"combine all occurrences of a function",
+	boolRef profileCoalesce),
        (Expert, "profile-il", " {source}", "where to insert profile exps",
 	SpaceString
 	(fn s =>
@@ -310,7 +313,7 @@
 	intRef textIOBufSize),
        (Expert, "type-check", " {false|true}", "type check ILs",
 	boolRef typeCheck),
-       (Normal, "v", "{|0|1|2|3}", "verbosity (also version number)"
+       (Normal, "v", "{|0|1|2|3}", "verbosity (also version number)",
 	String
 	(fn s =>
 	 verbosity := (case s of





-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel