Normalized Windows OS identification string with Pharo
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 25 Sep 2015 05:18:26 +0100
changeset 285 0cf54ee76de5
parent 284 6389d05c5faf
child 286 930f7307f70b
Normalized Windows OS identification string with Pharo
s/Benchmark.st
s/BenchmarkCountingInstrument.st
s/BenchmarkError.st
s/BenchmarkExecutionError.st
s/BenchmarkExecutionTimeInstrument.st
s/BenchmarkMeasurement.st
s/BenchmarkMeasurementInstrument.st
s/BenchmarkMeasurementValueNotAvailable.st
s/BenchmarkOutcome.st
s/BenchmarkParameter.st
s/BenchmarkParameterError.st
s/BenchmarkPlatform.st
s/BenchmarkReport.st
s/BenchmarkReportJSON.st
s/BenchmarkReportJSONWriter.st
s/BenchmarkReportText.st
s/BenchmarkRunnerExecutor.st
s/stx/BenchmarkMarkAndSweepCountInstrument.st
s/stx/BenchmarkPlatformStX.st
s/stx/BenchmarkRunnerAdapterStX.st
s/stx/BenchmarkScavengeCountInstrument.st
--- a/s/Benchmark.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/Benchmark.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#Benchmark
 	instanceVariableNames:''
 	classVariableNames:''
--- a/s/BenchmarkCountingInstrument.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkCountingInstrument.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkMeasurementInstrument subclass:#BenchmarkCountingInstrument
 	instanceVariableNames:'c0 c1'
 	classVariableNames:''
--- a/s/BenchmarkError.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkError.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Error subclass:#BenchmarkError
 	instanceVariableNames:''
 	classVariableNames:''
--- a/s/BenchmarkExecutionError.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkExecutionError.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkError subclass:#BenchmarkExecutionError
 	instanceVariableNames:''
 	classVariableNames:''
--- a/s/BenchmarkExecutionTimeInstrument.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkExecutionTimeInstrument.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkMeasurementInstrument subclass:#BenchmarkExecutionTimeInstrument
 	instanceVariableNames:'t0 t1'
 	classVariableNames:'MillisecondsTime'
--- a/s/BenchmarkMeasurement.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkMeasurement.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#BenchmarkMeasurement
 	instanceVariableNames:'value instrument'
 	classVariableNames:''
--- a/s/BenchmarkMeasurementInstrument.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkMeasurementInstrument.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#BenchmarkMeasurementInstrument
 	instanceVariableNames:''
 	classVariableNames:''
--- a/s/BenchmarkMeasurementValueNotAvailable.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkMeasurementValueNotAvailable.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#BenchmarkMeasurementValueNotAvailable
 	instanceVariableNames:''
 	classVariableNames:'Instance'
--- a/s/BenchmarkOutcome.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkOutcome.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#BenchmarkOutcome
 	instanceVariableNames:'measurements benchmark parameters'
 	classVariableNames:''
--- a/s/BenchmarkParameter.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkParameter.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#BenchmarkParameter
 	instanceVariableNames:'name type default values'
 	classVariableNames:'UndefinedValue'
--- a/s/BenchmarkParameterError.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkParameterError.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkError subclass:#BenchmarkParameterError
 	instanceVariableNames:''
 	classVariableNames:''
--- a/s/BenchmarkPlatform.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkPlatform.st	Fri Sep 25 05:18:26 2015 +0100
@@ -35,6 +35,14 @@
 "
 ! !
 
+!BenchmarkPlatform class methodsFor:'initialization'!
+
+setCurrent: aBenchmarkPlatform
+    Current := aBenchmarkPlatform
+
+    "Created: / 25-09-2015 / 05:31:37 / jv"
+! !
+
 !BenchmarkPlatform class methodsFor:'instance creation'!
 
 new
--- a/s/BenchmarkReport.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkReport.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#BenchmarkReport
 	instanceVariableNames:'stream result name description'
 	classVariableNames:''
--- a/s/BenchmarkReportJSON.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkReportJSON.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkReport subclass:#BenchmarkReportJSON
 	instanceVariableNames:'json'
 	classVariableNames:''
--- a/s/BenchmarkReportJSONWriter.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkReportJSONWriter.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#BenchmarkReportJSONWriter
 	instanceVariableNames:'stream indent'
 	classVariableNames:'Rules EscapeTable'
--- a/s/BenchmarkReportText.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkReportText.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkReport subclass:#BenchmarkReportText
 	instanceVariableNames:'colwidths colheaders colmap'
 	classVariableNames:''
--- a/s/BenchmarkRunnerExecutor.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/BenchmarkRunnerExecutor.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkExecutor subclass:#BenchmarkRunnerExecutor
 	instanceVariableNames:'transcript'
 	classVariableNames:''
--- a/s/stx/BenchmarkMarkAndSweepCountInstrument.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/stx/BenchmarkMarkAndSweepCountInstrument.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s/stx' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkCountingInstrument subclass:#BenchmarkMarkAndSweepCountInstrument
 	instanceVariableNames:''
 	classVariableNames:''
--- a/s/stx/BenchmarkPlatformStX.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/stx/BenchmarkPlatformStX.st	Fri Sep 25 05:18:26 2015 +0100
@@ -4,7 +4,7 @@
 
 BenchmarkPlatform subclass:#BenchmarkPlatformStX
 	instanceVariableNames:''
-	classVariableNames:''
+	classVariableNames:'WinVersionXlats'
 	poolDictionaries:''
 	category:'CalipeL-S-Smalltalk/X'
 !
@@ -40,9 +40,22 @@
 initialize
     "Invoked at system start or when the class is dynamically loaded."
 
-    Current := self new.
+    WinVersionXlats := Dictionary withKeysAndValues:#(
+        "Following are taken from:
+        https://msdn.microsoft.com/en-gb/library/windows/desktop/ms724832(v=vs.85).aspx"        
+        '5.0'    'Windows 2000'
+        '5.1'    'Windows XP'
+        '5.2'    'Windows Server 2003'
+        '6.0'    'Windows Vista / Server 2008'
+        '6.1'    'Windows 7 / Server 2008 R2'
+        '6.2'    'Windows 8 / Server 2012'
+        '6.3'    'Windows 8.1 / Server 2012 R2'
+        '10.0'   'Windows 10'
+        ).
+    self setCurrent: self new.
 
-    "Modified: / 21-05-2014 / 13:07:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-09-2015 / 05:13:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-09-2015 / 05:32:59 / jv"
 ! !
 
 !BenchmarkPlatformStX methodsFor:'accessing-performance counters'!
@@ -78,13 +91,22 @@
 configurationStringOS
     "superclass BenchmarkPlatform says that I am responsible to implement this method"
 
-    ^ OperatingSystem getSystemInfo at: #system
+    | sysinfo |
+
+    sysinfo := OperatingSystem getSystemInfo.
+    OperatingSystem isMSWINDOWSlike ifTrue:[ 
+        (sysinfo includesKey: #release) ifTrue:[ 
+            ^ WinVersionXlats at: (sysinfo at: #release) ifAbsent:[ sysinfo at: #system ]
+        ].
+    ].
+    ^ sysinfo at: #system
 
     "
     BenchmarkPlatform current configurationStringOS
     "
 
-    "Modified: / 21-09-2015 / 15:36:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-09-2015 / 05:16:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-09-2015 / 05:29:37 / jv"
 !
 
 configurationStringRuntime
--- a/s/stx/BenchmarkRunnerAdapterStX.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/stx/BenchmarkRunnerAdapterStX.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s/stx' }"
 
+"{ NameSpace: Smalltalk }"
+
 StandaloneStartup subclass:#BenchmarkRunnerAdapterStX
 	instanceVariableNames:''
 	classVariableNames:''
@@ -13,7 +15,7 @@
  The following class instance variables are inherited by this class:
 
 	StandaloneStartup - MutexHandle
-	Object -
+	Object - 
 "
 !
 
--- a/s/stx/BenchmarkScavengeCountInstrument.st	Wed Sep 23 16:26:37 2015 +0200
+++ b/s/stx/BenchmarkScavengeCountInstrument.st	Fri Sep 25 05:18:26 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'jv:calipel/s/stx' }"
 
+"{ NameSpace: Smalltalk }"
+
 BenchmarkCountingInstrument subclass:#BenchmarkScavengeCountInstrument
 	instanceVariableNames:''
 	classVariableNames:''