s/BenchmarkExecutionTimeInstrument.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 21 Mar 2016 13:15:35 +0100
changeset 314 9ac0be200068
parent 301 df951cc9a173
permissions -rw-r--r--
CI: Added CI scripts for Pharo ...to make Jenkins setup easier. To run CalipeL/S tests on Pharo, simply execute: wget -O "ci-pharo-common.sh" https://bitbucket.org/janvrany/jv-calipel/raw/tip/s/pharo/ci/ci-pharo-tests.sh | bash -x To run standard set ob benchmarks on Pharo, run wget -O "ci-pharo-common.sh" https://bitbucket.org/janvrany/jv-calipel/raw/tip/s/pharo/ci/ci-pharo-benchmarks.sh | bash -x

"{ Package: 'jv:calipel/s' }"

"{ NameSpace: Smalltalk }"

BenchmarkMeasurementInstrument subclass:#BenchmarkExecutionTimeInstrument
	instanceVariableNames:'t0 t1'
	classVariableNames:'MillisecondsTime'
	poolDictionaries:''
	category:'CalipeL-S-Core-Measurement'
!

!BenchmarkExecutionTimeInstrument class methodsFor:'documentation'!

documentation
"
    The one and only instrument that is guaranteed to be on every platform.
    It measures time to run a benchmark (real time).

    [author:]
        Jan Vrany <jan.vrany@fit.cvut.cz>

    [instance variables:]

    [class variables:]

    [see also:]

"
! !

!BenchmarkExecutionTimeInstrument methodsFor:'accessing'!

measurementInstrumentName
    "Returns a human-readable name of this instrument"
    
    ^ 'Execution Time'

    "Created: / 01-12-2014 / 02:36:15 / 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"
    
    ^ 'ms'

    "Created: / 24-11-2014 / 23:47:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 25-11-2014 / 01:09:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BenchmarkExecutionTimeInstrument methodsFor:'measurement'!

measurementStart:aBenchmarkInstance 
    "superclass BenchmarkMeasurementInstrument says that I am responsible to implement this method"
    
    t0 := BenchmarkPlatform current millisecondTime

    "Created: / 24-11-2014 / 08:49:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 27-11-2014 / 12:09:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 01-12-2014 / 02:44:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

measurementStop:aBenchmarkInstance 
    t1 := BenchmarkPlatform current millisecondTime

    "Created: / 24-11-2014 / 08:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 27-11-2014 / 12:09:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 01-12-2014 / 02:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

measurementValue
    ^ t1 - t0

    "Created: / 24-11-2014 / 08:49:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (comment): / 22-10-2015 / 08:07:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BenchmarkExecutionTimeInstrument methodsFor:'testing'!

isExecutionTimeInstrument
    ^ true

    "Created: / 24-11-2014 / 07:16:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !