Normalized runtime and OS identification strings.
Return runtime string as 'Smalltalk/X 6.2.4 32bit'. Translate return value
of `Smalltalk os version` to more user-friendly name such as
'Linux' or 'Windows 7'
--- a/s/BenchmarkPlatform.st Fri Sep 18 12:35:53 2015 +0100
+++ b/s/BenchmarkPlatform.st Mon Sep 21 23:31:06 2015 +0100
@@ -1,5 +1,7 @@
"{ Package: 'jv:calipel/s' }"
+"{ NameSpace: Smalltalk }"
+
Object subclass:#BenchmarkPlatform
instanceVariableNames:'instruments'
classVariableNames:'Current'
@@ -93,15 +95,23 @@
!
configurationStringOS
- self subclassResponsibility
+ "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
- self subclassResponsibility
+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'!
--- a/s/stx/BenchmarkPlatformStX.st Fri Sep 18 12:35:53 2015 +0100
+++ b/s/stx/BenchmarkPlatformStX.st Mon Sep 21 23:31:06 2015 +0100
@@ -1,5 +1,7 @@
"{ Package: 'jv:calipel/s/stx' }"
+"{ NameSpace: Smalltalk }"
+
BenchmarkPlatform subclass:#BenchmarkPlatformStX
instanceVariableNames:''
classVariableNames:''
@@ -76,35 +78,38 @@
configurationStringOS
"superclass BenchmarkPlatform says that I am responsible to implement this method"
- | sysinfo |
-
- sysinfo := OperatingSystem getSystemInfo.
+ ^ OperatingSystem getSystemInfo at: #system
- ^(sysinfo at: #system)
- , ' ' , (sysinfo at: #release)
- , ' ' , (sysinfo at: #machine)
+ "
+ BenchmarkPlatform current configurationStringOS
+ "
- "Modified: / 22-06-2013 / 23:01:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-09-2015 / 15:36:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
configurationStringRuntime
"superclass BenchmarkPlatform says that I am responsible to implement this method"
- | runtime |
+ ^ String streamContents:[ :str |
+ str nextPutAll:'Smalltalk/X '.
+ Smalltalk majorVersionNr printOn: str.
+ str nextPut:$..
+ Smalltalk minorVersionNr printOn: str.
+ str nextPut:$..
+ Smalltalk revisionNr printOn: str.
+ str space.
+ ExternalAddress pointerSize == 8 ifTrue:[
+ str nextPutAll: '64bit'
+ ] ifFalse:[
+ str nextPutAll: '32bit'
+ ].
+ ].
- runtime := 'Smalltalk/X ' ,
- Smalltalk majorVersionNr printString ,
- '.',
- Smalltalk minorVersionNr printString ,
- '.',
- Smalltalk revisionNr printString.
+ "
+ BenchmarkPlatform current configurationStringRuntime
+ "
- (Smalltalk versionString includesSubString: 'jv') ifTrue:[
- runtime := runtime , 'jv'
- ].
- ^runtime
-
- "Modified: / 22-06-2013 / 23:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-09-2015 / 15:43:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!BenchmarkPlatformStX methodsFor:'exit'!