--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/s/BenchmarkExecutor.st Fri Jul 26 00:32:44 2013 +0100
@@ -0,0 +1,84 @@
+"{ Package: 'jv:calipel/s' }"
+
+Object subclass:#BenchmarkExecutor
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'CalipeL-S-Core'
+!
+
+!BenchmarkExecutor class methodsFor:'documentation'!
+
+documentation
+"
+ A benchmark executor takes a signle BenchmarkInstance and a set of
+ parameter definitions and executes it. Returns a set of
+ BenchmarkOutcomes.
+
+ [author:]
+ Jan Vrany <jan.vrany@fit.cvut.cz>
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!BenchmarkExecutor methodsFor:'executing'!
+
+execute: aBenchmarkInstance result: aBenchmarkResult defines: aDictionary
+ "
+ Takes a benchmark instance and a set of parameter defines,
+ executes the benchmark and one or more outcomes into given
+ result.
+
+ This is where real execution happens"
+
+ | times |
+
+ [
+ self setUp: aBenchmarkInstance parameters: aDictionary.
+ self warmUp: aBenchmarkInstance.
+ times := (1 to: aBenchmarkResult runs) collect:[:i | self timeIt: aBenchmarkInstance ].
+ aBenchmarkResult addOutcome:
+ (BenchmarkOutcome
+ benchmark: aBenchmarkInstance
+ times: times
+ parameters: aBenchmarkInstance)
+ ] ensure:[
+ self tearDown: aBenchmarkInstance
+ ]
+
+ "Created: / 25-07-2013 / 23:51:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BenchmarkExecutor methodsFor:'executing-private'!
+
+setUp: aBenchmarkInstance parameters: aDictionary
+ aBenchmarkInstance setUpParameters: aDictionary.
+ aBenchmarkInstance setUp.
+
+ "Created: / 24-06-2013 / 01:11:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+tearDown: aBenchmarkInstance
+ aBenchmarkInstance tearDown.
+
+ "Created: / 24-06-2013 / 01:12:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+timeIt: aBenchmarkInstance
+ ^aBenchmarkInstance timeIt.
+
+ "Created: / 24-06-2013 / 01:11:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+warmUp: aBenchmarkInstance
+ aBenchmarkInstance warmUp.
+
+ "Created: / 24-06-2013 / 01:11:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+