Actual benchrmak running moved from BenchmarkInstance to BenchmarkResult.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 24 Jun 2013 00:56:32 +0100
changeset 97 98fdf7bfc237
parent 96 b3e57ae92f7f
child 98 4266d340e722
Actual benchrmak running moved from BenchmarkInstance to BenchmarkResult.
s/BenchmarkInstance.st
s/BenchmarkResult.st
s/s.rc
--- a/s/BenchmarkInstance.st	Sun Jun 23 21:09:43 2013 +0100
+++ b/s/BenchmarkInstance.st	Mon Jun 24 00:56:32 2013 +0100
@@ -217,22 +217,6 @@
     "Created: / 27-05-2013 / 22:18:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-runBenchmarkWithParameters:aBenchmarkParameterSet 
-    | t |
-
-    t := -1.
-    [
-        self setUpParameters:aBenchmarkParameterSet.
-        self setUp.
-        self warmUp.
-        t := self benchmark.
-    ] ensure:[ self tearDown. ].
-    ^ t
-
-    "Created: / 27-05-2013 / 22:25:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 11-06-2013 / 01:16:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 runWith: aDictionary
     ^self run: BenchmarkResult new with: aDictionary
 
@@ -241,18 +225,6 @@
 
 !BenchmarkInstance methodsFor:'running-private'!
 
-benchmark
-    | t0  t1 |
-
-    t0 := MillisecondsTime value.
-    instance perform:benchmarkSelector.
-    t1 := MillisecondsTime value.
-    ^ t1 - t0
-
-    "Created: / 28-05-2013 / 08:49:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 31-05-2013 / 12:02:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 setUp
     setUpSelector1 notNil ifTrue:[
         instance perform: setUpSelector1 
@@ -324,6 +296,17 @@
     "Modified: / 28-05-2013 / 10:58:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+timeIt
+    | t0  t1 |
+
+    t0 := MillisecondsTime value.
+    instance perform:benchmarkSelector.
+    t1 := MillisecondsTime value.
+    ^ t1 - t0
+
+    "Created: / 24-06-2013 / 00:51:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 warmUp
     | warmed |
 
--- a/s/BenchmarkResult.st	Sun Jun 23 21:09:43 2013 +0100
+++ b/s/BenchmarkResult.st	Mon Jun 24 00:56:32 2013 +0100
@@ -124,18 +124,30 @@
 !BenchmarkResult methodsFor:'running-private'!
 
 runBenchmark:aBenchmarkInstance withParameters: aDictionary
+    "The workhorse that runs the given benchmark.
+
+     It performs necessary setup, warmup, actual measurements
+     and finally teardown."
+    
     | times |
 
     self initializeTimestampIfNotAlready.
-    times := (1 to: runs) collect: [:i | aBenchmarkInstance runBenchmarkWithParameters: aDictionary].
-    outcomes add:
-        (BenchmarkOutcome 
-            benchmark: aBenchmarkInstance
-            times: times
-            parameters: aBenchmarkInstance)
+    [
+        aBenchmarkInstance setUpParameters: aDictionary.
+        aBenchmarkInstance setUp.
+        aBenchmarkInstance warmUp.
+        times := (1 to: runs) collect:[:i | aBenchmarkInstance timeIt ].
+        outcomes add:
+            (BenchmarkOutcome 
+                benchmark: aBenchmarkInstance
+                times: times
+                parameters: aBenchmarkInstance)
+    ] ensure:[
+        aBenchmarkInstance tearDown
+    ]
 
     "Created: / 27-05-2013 / 22:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 23-06-2013 / 00:39:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-06-2013 / 00:53:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BenchmarkResult class methodsFor:'documentation'!
--- a/s/s.rc	Sun Jun 23 21:09:43 2013 +0100
+++ b/s/s.rc	Mon Jun 24 00:56:32 2013 +0100
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: jv_calipel_s.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,373,373
+  FILEVERSION     6,2,32767,32767
   PRODUCTVERSION  6,2,3,0
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "My Company\0"
       VALUE "FileDescription", "Class Library (LIB)\0"
-      VALUE "FileVersion", "6.2.373.373\0"
+      VALUE "FileVersion", "6.2.32767.32767\0"
       VALUE "InternalName", "jv:calipel/s\0"
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "LibraryName\0"
       VALUE "ProductVersion", "6.2.3.0\0"
-      VALUE "ProductDate", "Sun, 23 Jun 2013 01:36:05 GMT\0"
+      VALUE "ProductDate", "Sun, 23 Jun 2013 23:55:28 GMT\0"
     END
 
   END