Workspace.st
changeset 4471 6b403ca6c388
parent 4459 2b9b54d95778
child 4472 1eef89af0ef0
--- a/Workspace.st	Thu Nov 01 15:23:56 2012 +0100
+++ b/Workspace.st	Sun Nov 04 22:43:35 2012 +0100
@@ -1882,6 +1882,27 @@
     "Modified: / 08-03-2012 / 16:14:34 / cg"
 !
 
+profileIt
+    "user selected 'profileIt' from menu; show a wait-cursor, profile the code
+     and finally restore cursor.
+     OPen a visual profiler on the sample data.
+     Return result of evaluation"
+
+    |code|
+
+    compilerClass == Smalltalk::Compiler ifFalse:[
+        "sigh - this measurement will include the time to compile - sigh"
+        Tools::Profiler spyDetailedOn:[ self doIt ].
+        ^ self.
+    ].
+
+    code := 'Tools::Profiler spyDetailedOn:[' , self selectionAsString, ']'.
+    self do:code withValueDo:[:value| ].
+
+    "Modified: / 22-04-1998 / 22:03:53 / ca"
+    "Modified: / 02-06-2012 / 00:39:13 / cg"
+!
+
 replaceIt
     "like printIt, but replace the selection with the result, instead of
      pasting it after the selection."
@@ -2036,9 +2057,9 @@
 !Workspace class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.254 2012-10-16 12:00:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.255 2012-11-04 21:43:35 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.254 2012-10-16 12:00:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.255 2012-11-04 21:43:35 cg Exp $'
 ! !