added: #microsecondsToRun:
authorStefan Vogel <sv@exept.de>
Wed, 31 Mar 2010 15:52:36 +0200
changeset 12831 97be4636cf07
parent 12830 f6935e0c07a3
child 12832 fd20ec4fb909
added: #microsecondsToRun:
AbstractTime.st
--- a/AbstractTime.st	Wed Mar 31 11:41:13 2010 +0200
+++ b/AbstractTime.st	Wed Mar 31 15:52:36 2010 +0200
@@ -308,6 +308,21 @@
 
 !AbstractTime class methodsFor:'timing evaluations'!
 
+microsecondsToRun:aBlock
+    "evaluate the argument, aBlock; return the number of milliseconds it took"
+
+    |startTime endTime|
+
+    startTime := OperatingSystem getMicrosecondTime.
+    aBlock value.
+    endTime := OperatingSystem getMicrosecondTime.
+    ^ endTime - startTime
+
+    "
+     Time microsecondsToRun:[1000 factorial]  
+    "
+!
+
 millisecondsToRun:aBlock
     "evaluate the argument, aBlock; return the number of milliseconds it took"
 
@@ -1140,9 +1155,9 @@
 !AbstractTime class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.67 2010-01-27 14:09:56 sr Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.68 2010-03-31 13:52:36 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.67 2010-01-27 14:09:56 sr Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.68 2010-03-31 13:52:36 stefan Exp $'
 ! !