s/BenchmarkMeasurementInstrument.st
changeset 262 8d2849dd3227
child 285 0cf54ee76de5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/s/BenchmarkMeasurementInstrument.st	Wed Dec 03 23:53:25 2014 +0000
@@ -0,0 +1,95 @@
+"{ Package: 'jv:calipel/s' }"
+
+Object subclass:#BenchmarkMeasurementInstrument
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'CalipeL-S-Core-Measurement'
+!
+
+!BenchmarkMeasurementInstrument class methodsFor:'documentation'!
+
+documentation
+"
+    Measurement instrument provides a way to measure a particular
+    aspect (time, number og GCs, invocations of some method...).
+
+    One may create a custom instruments and hook them in to measure
+    custom, application specific aspects.
+
+    [author:]
+        Jan Vrany <jan.vrany@fit.cvut.cz>
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!BenchmarkMeasurementInstrument class methodsFor:'testing'!
+
+isExecuttionTimeInstrument: instrument
+    ^ (instrument respondsTo:#isExecutionTimeInstrument) and:[instrument isExecutionTimeInstrument]
+
+    "Created: / 02-12-2014 / 23:26:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BenchmarkMeasurementInstrument methodsFor:'accessing'!
+
+measurementInstrumentName
+    "Returns a human-readable name of this instrument"
+    
+    ^ self subclassResponsibility
+
+    "Created: / 01-12-2014 / 02:35:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+measurementUnit
+    "Return a string describing a unit of this instrument, i.e., msecs
+     for time or '1' for plain counters"
+    
+    ^ self subclassResponsibility
+
+    "Created: / 24-11-2014 / 23:47:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BenchmarkMeasurementInstrument methodsFor:'measurement'!
+
+measurementStart:aBenchmarkInstance 
+    ^ self subclassResponsibility
+
+    "Created: / 24-11-2014 / 08:14:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 01-12-2014 / 02:44:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+measurementStop:aBenchmarkInstance 
+    ^ self subclassResponsibility
+
+    "Created: / 24-11-2014 / 08:14:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 01-12-2014 / 02:44:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+measurementValue
+    ^ self subclassResponsibility
+
+    "Created: / 24-11-2014 / 08:14:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BenchmarkMeasurementInstrument methodsFor:'testing'!
+
+isExecutionTimeInstrument
+    ^ false
+
+    "Created: / 24-11-2014 / 07:15:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BenchmarkMeasurementInstrument class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+