The Trunk: System-cmm.696.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-cmm.696.mcz

commits-2
Chris Muller uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-cmm.696.mcz

==================== Summary ====================

Name: System-cmm.696
Author: cmm
Time: 17 January 2015, 7:00:32.693 pm
UUID: e13e847b-b9e1-4068-bb77-48d54a9cd005
Ancestors: System-kfr.695, System-cmm.694

- Remove the crazy check for MessageNotUnderstood in Smalltalk #run:..  Headless mode should always exit on any Error.
- In fact, even when not in headless mode, we don't need to halt but simply #pass the Error to the default handler for Errors do what it does, whether that's popping a debugger which could be resumed (if the Error isResumable) or something else.

=============== Diff against System-kfr.695 ===============

Item was removed:
- ----- Method: SmalltalkImage>>haltOrQuit (in category 'command line') -----
- haltOrQuit
- self isHeadless
- ifTrue:
- [ self
- snapshot: false
- andQuit: true ]
- ifFalse: [ self halt ]!

Item was changed:
  ----- Method: SmalltalkImage>>run: (in category 'command line') -----
+ run: aBlock
- run: aBlock
  [ [ (aBlock numArgs = 1 and: [ self arguments size > 1 ])
+ ifTrue: [ "Allow a large, variable number of arguments to be passed as an Array to aBlock."
- ifTrue:
- [ "Allow a large, variable number of arguments to be passed as an Array to aBlock."
  aBlock value: self arguments ]
  ifFalse: [ aBlock valueWithEnoughArguments: self arguments ] ]
  on: ProgressInitiationException
  do:
  [ : pie | "Don't want to log this notification."
  pie defaultAction ] ]
  on: Notification , Warning
  do:
  [ : noti | FileStream stdout
  nextPutAll: DateAndTime now asString ;
  space ;
  nextPutAll: noti description ;
  cr.
  noti resume ]
  on: SyntaxErrorNotification
  do:
  [ : err | FileStream stdout
  nextPutAll: err errorCode ;
+ cr; flush.
+ self isHeadless
+ ifTrue: [ self snapshot: false andQuit: true ]
+ ifFalse: [ err pass ] ]
- cr.
- self haltOrQuit ]
  on: Error
  do:
  [ : err | err printVerboseOn: FileStream stderr.
+ FileStream stderr flush.
+ self isHeadless
+ ifTrue: [ self snapshot: false andQuit: true ]
+ ifFalse: [ err pass ] ]!
- self haltOrQuit.
- err isResumable ifTrue: [ err resume ] ]!

Item was changed:
  ----- Method: SmalltalkImage>>vmStatisticsReportString (in category 'vm statistics') -----
  vmStatisticsReportString
  "(Workspace new contents: Smalltalk vmStatisticsReportString)
  openLabel: 'VM Statistics'"
  "StringHolderView
  open: (StringHolder new contents: Smalltalk vmStatisticsReportString)
  label: 'VM Statistics'"
 
  | params onSpur oldSpaceEnd youngSpaceEnd memorySize fullGCs fullGCTime incrGCs incrGCTime tenureCount upTime upTime2 fullGCs2 fullGCTime2 incrGCs2 incrGCTime2 tenureCount2 str freeSize youngSize used |
  params := self getVMParameters.
+ onSpur := (params at: 41 ifAbsent: [ 0 ]) anyMask: 16.
- onSpur := (params at: 41) anyMask: 16.
  oldSpaceEnd := params at: 1.
  youngSpaceEnd := params at: 2.
  memorySize := params at: 3.
  fullGCs := params at: 7.
  fullGCTime := params at: 8.
  incrGCs := params at: 9.
  incrGCTime := params at: 10.
  tenureCount := params at: 11.
  upTime := Time millisecondClockValue.
 
  str := WriteStream on: (String new: 700).
  str nextPutAll: 'uptime ';
  print: (upTime / 1000 / 60 // 60); nextPut: $h;
  print: (upTime / 1000 / 60 \\ 60) asInteger; nextPut: $m;
  print: (upTime / 1000 \\ 60) asInteger; nextPut: $s; cr.
 
  str nextPutAll: 'memory ';
  nextPutAll: memorySize asStringWithCommas; nextPutAll: ' bytes'; cr.
  str nextPutAll: ' old ';
  nextPutAll: oldSpaceEnd asStringWithCommas; nextPutAll: ' bytes (';
  print: (oldSpaceEnd / memorySize * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
  youngSize := onSpur
  ifTrue: [params at: 44 "eden size"] "Spur"
  ifFalse:  [youngSpaceEnd - oldSpaceEnd]. "Squeak V3"
  str nextPutAll: ' young ';
  nextPutAll: youngSize asStringWithCommas; nextPutAll: ' bytes (';
  print: youngSize / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
  onSpur ifTrue: [youngSize := youngSpaceEnd "used eden"].
  freeSize := onSpur
  ifTrue: [(params at: 54) + (params at: 44) - youngSize] "Spur"
  ifFalse:  [memorySize - youngSpaceEnd] "Squeak V3".
  used := onSpur
  ifTrue: [youngSize + oldSpaceEnd - freeSize] "Spur"
  ifFalse:  [youngSpaceEnd]. "Squeak V3"
  str nextPutAll: ' used ';
  nextPutAll: used asStringWithCommas; nextPutAll: ' bytes (';
  print: used / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
  str nextPutAll: ' free ';
  nextPutAll: freeSize asStringWithCommas; nextPutAll: ' bytes (';
  print: freeSize / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
 
  str nextPutAll: 'GCs ';
  nextPutAll: (fullGCs + incrGCs) asStringWithCommas.
  fullGCs + incrGCs > 0 ifTrue: [
  str
  nextPutAll: ' (';
  print: (upTime / (fullGCs + incrGCs)) maxDecimalPlaces: 1;
  nextPutAll: ' ms between GCs)'
  ].
  str cr.
  str nextPutAll: ' full ';
  nextPutAll: fullGCs asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime asStringWithCommas; nextPutAll: ' ms (';
  print: (fullGCTime / upTime * 100) maxDecimalPlaces: 1;
  nextPutAll: '% uptime)'.
  fullGCs = 0 ifFalse:
  [str nextPutAll: ', avg '; print: (fullGCTime / fullGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'].
  str cr.
  str nextPutAll: ' incr ';
  nextPutAll: incrGCs asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime asStringWithCommas; nextPutAll: ' ms (';
  print: (incrGCTime / upTime * 100) maxDecimalPlaces: 1;
  nextPutAll: '% uptime), avg '; print: (incrGCTime / incrGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'; cr.
  str nextPutAll: ' tenures ';
  nextPutAll: tenureCount asStringWithCommas.
  tenureCount = 0 ifFalse:
  [str nextPutAll: ' (avg '; print: incrGCs // tenureCount; nextPutAll: ' GCs/tenure)'].
  str cr.
 
  LastStats ifNil: [LastStats := Array new: 6]
  ifNotNil: [
  upTime2 := upTime - (LastStats at: 1).
  fullGCs2 := fullGCs - (LastStats at: 2).
  fullGCTime2 := fullGCTime - (LastStats at: 3).
  incrGCs2 := incrGCs - (LastStats at: 4).
  incrGCTime2 := incrGCTime - (LastStats at: 5).
  tenureCount2 := tenureCount - (LastStats at: 6).
 
  str nextPutAll: self textMarkerForShortReport ;
  nextPutAll: (fullGCs2 + incrGCs2) asStringWithCommas.
  fullGCs2 + incrGCs2 > 0 ifTrue: [
  str
  nextPutAll: ' (';
  print: upTime2 // (fullGCs2 + incrGCs2);
  nextPutAll: ' ms between GCs)'.
  ].
  str cr.
  str nextPutAll: ' uptime '; print: (upTime2 / 1000.0) maxDecimalPlaces: 1; nextPutAll: ' s'; cr.
  str nextPutAll: ' full ';
  nextPutAll: fullGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime2 asStringWithCommas; nextPutAll: ' ms (';
  print: (fullGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;
  nextPutAll: '% uptime)'.
  fullGCs2 = 0 ifFalse:
  [str nextPutAll: ', avg '; print: (fullGCTime2 / fullGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'].
  str cr.
  str nextPutAll: ' incr ';
  nextPutAll: incrGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime2 asStringWithCommas; nextPutAll: ' ms (';
  print: (incrGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;
  nextPutAll: '% uptime), avg '.
  incrGCs2 > 0 ifTrue: [
  str print: (incrGCTime2 / incrGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'
  ].
  str cr.
  str nextPutAll: ' tenures ';
  nextPutAll: tenureCount2 asStringWithCommas.
  tenureCount2 = 0 ifFalse:
  [str nextPutAll: ' (avg '; print: incrGCs2 // tenureCount2; nextPutAll: ' GCs/tenure)'].
  str cr.
  ].
  LastStats at: 1 put: upTime.
  LastStats at: 2 put: fullGCs.
  LastStats at: 3 put: fullGCTime.
  LastStats at: 4 put: incrGCs.
  LastStats at: 5 put: incrGCTime.
  LastStats at: 6 put: tenureCount.
 
  ^ str contents
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: System-cmm.696.mcz

Chris Muller-3
I went one step further and simply pass Errors and letting default handler resume them if they are resumable.

Since the code is now so explicit about quitting or passing, it seems a comment is not needed.

On Sat, Jan 17, 2015 at 7:00 PM, <[hidden email]> wrote:
Chris Muller uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-cmm.696.mcz

==================== Summary ====================

Name: System-cmm.696
Author: cmm
Time: 17 January 2015, 7:00:32.693 pm
UUID: e13e847b-b9e1-4068-bb77-48d54a9cd005
Ancestors: System-kfr.695, System-cmm.694

- Remove the crazy check for MessageNotUnderstood in Smalltalk #run:..  Headless mode should always exit on any Error.
- In fact, even when not in headless mode, we don't need to halt but simply #pass the Error to the default handler for Errors do what it does, whether that's popping a debugger which could be resumed (if the Error isResumable) or something else.

=============== Diff against System-kfr.695 ===============

Item was removed:
- ----- Method: SmalltalkImage>>haltOrQuit (in category 'command line') -----
- haltOrQuit
-       self isHeadless
-               ifTrue:
-                       [ self
-                               snapshot: false
-                               andQuit: true ]
-               ifFalse: [ self halt ]!

Item was changed:
  ----- Method: SmalltalkImage>>run: (in category 'command line') -----
+ run: aBlock
- run: aBlock
        [ [ (aBlock numArgs = 1 and: [ self arguments size > 1 ])
+               ifTrue: [ "Allow a large, variable number of arguments to be passed as an Array to aBlock."
-               ifTrue:
-                       [ "Allow a large, variable number of arguments to be passed as an Array to aBlock."
                        aBlock value: self arguments ]
                ifFalse: [ aBlock valueWithEnoughArguments: self arguments ] ]
                on: ProgressInitiationException
                do:
                        [ : pie | "Don't want to log this notification."
                        pie defaultAction ] ]
                on: Notification , Warning
                do:
                        [ : noti | FileStream stdout
                                 nextPutAll: DateAndTime now asString ;
                                 space ;
                                 nextPutAll: noti description ;
                                 cr.
                        noti resume ]
                on: SyntaxErrorNotification
                do:
                        [ : err | FileStream stdout
                                 nextPutAll: err errorCode ;
+                                cr; flush.
+                       self isHeadless
+                               ifTrue: [ self snapshot: false andQuit: true ]
+                               ifFalse: [ err pass ] ]
-                                cr.
-                       self haltOrQuit ]
                on: Error
                do:
                        [ : err | err printVerboseOn: FileStream stderr.
+                       FileStream stderr flush.
+                       self isHeadless
+                               ifTrue: [ self snapshot: false andQuit: true ]
+                               ifFalse: [ err pass ] ]!
-                       self haltOrQuit.
-                       err isResumable ifTrue: [ err resume ] ]!

Item was changed:
  ----- Method: SmalltalkImage>>vmStatisticsReportString (in category 'vm statistics') -----
  vmStatisticsReportString
        "(Workspace new contents: Smalltalk vmStatisticsReportString)
                openLabel: 'VM Statistics'"
        "StringHolderView
                open: (StringHolder new contents: Smalltalk vmStatisticsReportString)
                label: 'VM Statistics'"

        | params onSpur oldSpaceEnd youngSpaceEnd memorySize fullGCs fullGCTime incrGCs incrGCTime tenureCount upTime upTime2 fullGCs2 fullGCTime2 incrGCs2 incrGCTime2 tenureCount2 str freeSize youngSize used |
        params := self getVMParameters.
+       onSpur := (params at: 41 ifAbsent: [ 0 ]) anyMask: 16.
-       onSpur := (params at: 41) anyMask: 16.
        oldSpaceEnd                     := params at: 1.
        youngSpaceEnd           := params at: 2.
        memorySize                      := params at: 3.
        fullGCs                         := params at: 7.
        fullGCTime                      := params at: 8.
        incrGCs                         := params at: 9.
        incrGCTime                      := params at: 10.
        tenureCount                     := params at: 11.
        upTime := Time millisecondClockValue.

        str := WriteStream on: (String new: 700).
        str     nextPutAll: 'uptime                     ';
                print: (upTime / 1000 / 60 // 60); nextPut: $h;
                print: (upTime / 1000 / 60 \\ 60) asInteger; nextPut: $m;
                print: (upTime / 1000 \\ 60) asInteger; nextPut: $s; cr.

        str     nextPutAll: 'memory             ';
                nextPutAll: memorySize asStringWithCommas; nextPutAll: ' bytes'; cr.
        str     nextPutAll:     '       old                     ';
                nextPutAll: oldSpaceEnd asStringWithCommas; nextPutAll: ' bytes (';
                print: (oldSpaceEnd / memorySize * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
        youngSize := onSpur
                                                ifTrue: [params at: 44 "eden size"] "Spur"
                                                ifFalse:  [youngSpaceEnd - oldSpaceEnd]. "Squeak V3"
        str     nextPutAll: '   young           ';
                nextPutAll: youngSize asStringWithCommas; nextPutAll: ' bytes (';
                print: youngSize / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
        onSpur ifTrue: [youngSize := youngSpaceEnd "used eden"].
        freeSize := onSpur
                                                ifTrue: [(params at: 54) + (params at: 44) - youngSize] "Spur"
                                                ifFalse:  [memorySize - youngSpaceEnd] "Squeak V3".
        used := onSpur
                                ifTrue: [youngSize + oldSpaceEnd - freeSize] "Spur"
                                ifFalse:  [youngSpaceEnd]. "Squeak V3"
        str     nextPutAll: '   used            ';
                nextPutAll: used asStringWithCommas; nextPutAll: ' bytes (';
                print: used / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
        str     nextPutAll: '   free            ';
                nextPutAll: freeSize asStringWithCommas; nextPutAll: ' bytes (';
                print: freeSize / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.

        str     nextPutAll: 'GCs                        ';
                nextPutAll: (fullGCs + incrGCs) asStringWithCommas.
        fullGCs + incrGCs > 0 ifTrue: [
                str
                        nextPutAll: ' (';
                        print: (upTime / (fullGCs + incrGCs)) maxDecimalPlaces: 1;
                        nextPutAll: ' ms between GCs)'
        ].
        str cr.
        str     nextPutAll: '   full                    ';
                nextPutAll: fullGCs asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime asStringWithCommas; nextPutAll: ' ms (';
                print: (fullGCTime / upTime * 100) maxDecimalPlaces: 1;
                nextPutAll: '% uptime)'.
        fullGCs = 0 ifFalse:
                [str    nextPutAll: ', avg '; print: (fullGCTime / fullGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'].
        str     cr.
        str     nextPutAll: '   incr                    ';
                nextPutAll: incrGCs asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime asStringWithCommas; nextPutAll: ' ms (';
                print: (incrGCTime / upTime * 100) maxDecimalPlaces: 1;
                nextPutAll: '% uptime), avg '; print: (incrGCTime / incrGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'; cr.
        str     nextPutAll: '   tenures         ';
                nextPutAll: tenureCount asStringWithCommas.
        tenureCount = 0 ifFalse:
                [str nextPutAll: ' (avg '; print: incrGCs // tenureCount; nextPutAll: ' GCs/tenure)'].
        str     cr.

  LastStats ifNil: [LastStats := Array new: 6]
  ifNotNil: [
        upTime2 := upTime - (LastStats at: 1).
        fullGCs2 := fullGCs - (LastStats at: 2).
        fullGCTime2 := fullGCTime - (LastStats at: 3).
        incrGCs2 := incrGCs - (LastStats at: 4).
        incrGCTime2 := incrGCTime - (LastStats at: 5).
        tenureCount2 := tenureCount - (LastStats at: 6).

        str     nextPutAll: self textMarkerForShortReport ;
                nextPutAll: (fullGCs2 + incrGCs2) asStringWithCommas.
        fullGCs2 + incrGCs2 > 0 ifTrue: [
                str
                        nextPutAll: ' (';
                        print: upTime2 // (fullGCs2 + incrGCs2);
                        nextPutAll: ' ms between GCs)'.
        ].
        str cr.
        str     nextPutAll: '   uptime          '; print: (upTime2 / 1000.0) maxDecimalPlaces: 1; nextPutAll: ' s'; cr.
        str     nextPutAll: '   full                    ';
                nextPutAll: fullGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime2 asStringWithCommas; nextPutAll: ' ms (';
                print: (fullGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;
                nextPutAll: '% uptime)'.
        fullGCs2 = 0 ifFalse:
                [str    nextPutAll: ', avg '; print: (fullGCTime2 / fullGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'].
        str     cr.
        str     nextPutAll: '   incr                    ';
                nextPutAll: incrGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime2 asStringWithCommas; nextPutAll: ' ms (';
                print: (incrGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;
                nextPutAll: '% uptime), avg '.
        incrGCs2 > 0 ifTrue: [
                 str print: (incrGCTime2 / incrGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'
        ].
        str cr.
        str     nextPutAll: '   tenures         ';
                nextPutAll: tenureCount2 asStringWithCommas.
        tenureCount2 = 0 ifFalse:
                [str nextPutAll: ' (avg '; print: incrGCs2 // tenureCount2; nextPutAll: ' GCs/tenure)'].
        str     cr.
  ].
        LastStats at: 1 put: upTime.
        LastStats at: 2 put: fullGCs.
        LastStats at: 3 put: fullGCTime.
        LastStats at: 4 put: incrGCs.
        LastStats at: 5 put: incrGCTime.
        LastStats at: 6 put: tenureCount.

        ^ str contents
  !