s/BenchmarkPlatform.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 25 Sep 2015 05:18:26 +0100
changeset 285 0cf54ee76de5
parent 283 51f9245f0cb2
child 288 3e9a0ef23dfd
permissions -rw-r--r--
Normalized Windows OS identification string with Pharo

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

"{ NameSpace: Smalltalk }"

Object subclass:#BenchmarkPlatform
	instanceVariableNames:'instruments'
	classVariableNames:'Current'
	poolDictionaries:''
	category:'CalipeL-S-Core'
!

!BenchmarkPlatform class methodsFor:'documentation'!

documentation
"
 Replace 'Object', 'NewClass1' and
 the empty string arguments by true values.

 Install (or change) the class by 'accepting',
 either via the menu or the keyboard (usually CMD-A).

 You can also change the category simply by editing
 the categoryString and accepting.

 To be nice to others (and yourself later), do not forget to
 add some documentation; preferably under the classes documentation
 protocol.
 (see the `create documentation stubs' item in the methodList menu;
  switch from instance to class to find this menu item.)

 Notice, that ST/X uses the convention to document the class using
 comment-only class methods (however, ST80 comments are supported and
 can be changed via the class-documentation menu).

"
! !

!BenchmarkPlatform class methodsFor:'initialization'!

setCurrent: aBenchmarkPlatform
    Current := aBenchmarkPlatform

    "Created: / 25-09-2015 / 05:31:37 / jv"
! !

!BenchmarkPlatform class methodsFor:'instance creation'!

new
    "return an initialized instance"

    ^ self basicNew initialize.
! !

!BenchmarkPlatform class methodsFor:'accessing'!

current
    ^Current

    "Created: / 06-06-2013 / 08:54:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BenchmarkPlatform methodsFor:'accessing-instruments'!

instruments
    "Return a list of non-intrusive instruments available on this
     platform."

    "`instruments` variable is initialized in #initialize"
    ^ instruments

    "Created: / 27-11-2014 / 12:37:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (comment): / 27-11-2014 / 13:41:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BenchmarkPlatform methodsFor:'accessing-performance counters'!

millisecondTime
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility
! !

!BenchmarkPlatform methodsFor:'acessing-streams'!

stderr
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility
!

stdout
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility
! !

!BenchmarkPlatform methodsFor:'configuration'!

configurationStringMachineId
    self subclassResponsibility

    "Created: / 13-07-2013 / 22:45:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

configurationStringOS
    "Return the operating system on which the system is running such as
     'Linux' or 'Windows XP'"

    ^ self subclassResponsibility

    "Created: / 22-06-2013 / 22:55:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 21-09-2015 / 15:36:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

configurationStringRuntime  
    "Return the runtime identification string, for example
     'Smalltalk/X 6.2.5 642bit' or 'Pharo 5.0 32bit'."

    ^ self subclassResponsibility

    "Created: / 22-06-2013 / 22:55:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 21-09-2015 / 15:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BenchmarkPlatform methodsFor:'exit'!

exit:arg
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility
! !

!BenchmarkPlatform methodsFor:'initialization'!

initialize
    "Invoked when a new instance is created."

    super initialize.
    instruments := Array 
                    with: BenchmarkExecutionTimeInstrument new

    "Modified (format): / 27-11-2014 / 13:42:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BenchmarkPlatform methodsFor:'queries'!

isHeadless
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility
!

isPharo
    ^false

    "Modified: / 06-06-2013 / 09:40:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isSmalltalkX
    ^false

    "Modified: / 06-06-2013 / 09:40:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BenchmarkPlatform methodsFor:'running'!

warmUpPost
    "Called after benchmark's warmup"

    "Created: / 07-06-2013 / 02:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

warmUpPre
    "Called before benchmark's warmup"

    "Created: / 07-06-2013 / 02:09:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BenchmarkPlatform class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !