#QUALITY by cg
authorClaus Gittinger <cg@exept.de>
Sun, 05 Feb 2017 18:22:39 +0100
changeset 21345 010dc1b3e44d
parent 21344 850a2a85195e
child 21346 d6e6fce1a736
#QUALITY by cg class: Block changed: #benchmark:
Block.st
--- a/Block.st	Sun Feb 05 17:02:20 2017 +0100
+++ b/Block.st	Sun Feb 05 18:22:39 2017 +0100
@@ -709,7 +709,6 @@
 ! !
 
 
-
 !Block methodsFor:'accessing'!
 
 home
@@ -889,7 +888,7 @@
     endTime := OperatingSystem getMicrosecondTime.
     overhead := endTime - startTime.
     "/ just in case, the OS does not support cpu cycles
-    overheadCycles := endCycles - startCycles.
+    startCycles notNil ifTrue:[ overheadCycles := endCycles - startCycles ].
     
     startTime := OperatingSystem getMicrosecondTime.
     startCycles := OperatingSystem getCPUCycleCount.
@@ -898,7 +897,10 @@
     endTime := OperatingSystem getMicrosecondTime.
 
     micros := (endTime - startTime - overhead) max:0.
-    cycles := (endCycles - startCycles - overheadCycles) max:0. 
+    "/ just in case, the OS does not support cpu cycles
+    startCycles notNil ifTrue:[
+        cycles := (endCycles - startCycles - overheadCycles) max:0. 
+    ].
     
     Transcript show:anInfoString.
     micros < 1000 ifTrue:[
@@ -914,7 +916,7 @@
             Transcript show:(TimeDuration milliseconds:millis).
         ].
     ].
-    cycles ~~ 0 ifTrue:[
+    cycles notNil ifTrue:[
         Transcript show:' ('; show:cycles; show:' cycles)'.
     ].
     Transcript cr.