[squeak-dev] The Trunk: System-bf.488.mcz

Bert Freudenberg bert at freudenbergs.de
Mon Jul 9 16:05:52 UTC 2012


On 2012-07-09, at 17:57, Chris Muller wrote:

> Beat me to it but you forgot to update the sends to
> #asStringWithCommasSigned.  It was deprecated because this is the only
> sender and it's an exceptional case to want to print "+" in front.  We
> should use #asStringWithCommasSigned: true.

Feel free to improve :)

Another idea would be to tweak roundTo: so the result would print as expected. Any floating point magician out there? ;)

- Bert -

> On Mon, Jul 9, 2012 at 7:55 AM,  <commits at source.squeak.org> wrote:
>> Bert Freudenberg uploaded a new version of System to project The Trunk:
>> http://source.squeak.org/trunk/System-bf.488.mcz
>> 
>> ==================== Summary ====================
>> 
>> Name: System-bf.488
>> Author: bf
>> Time: 9 July 2012, 2:55:32.107 pm
>> UUID: 1f332f03-ee04-4f81-8e73-c2e3b203a85d
>> Ancestors: System-eem.487
>> 
>> Format floats using print:maxDecimalPlaces: instead of roundTo:.
>> 
>> =============== Diff against System-eem.487 ===============
>> 
>> Item was changed:
>>  ----- Method: MessageTally>>reportGCStatsOn: (in category 'reporting') -----
>>  reportGCStatsOn: str
>>        | oldSpaceEnd youngSpaceEnd memoryEnd fullGCs fullGCTime incrGCs incrGCTime tenureCount upTime rootOverflows |
>>        upTime := time.
>>        oldSpaceEnd                     := gcStats at: 1.
>>        youngSpaceEnd           := gcStats at: 2.
>>        memoryEnd                       := gcStats at: 3.
>>        fullGCs                         := gcStats at: 7.
>>        fullGCTime                      := gcStats at: 8.
>>        incrGCs                         := gcStats at: 9.
>>        incrGCTime                      := gcStats at: 10.
>>        tenureCount                     := gcStats at: 11.
>>        rootOverflows           := gcStats at: 22.
>> 
>>        str cr.
>>        str     nextPutAll: '**Memory**'; cr.
>>        str     nextPutAll:     '       old                     ';
>>                nextPutAll: oldSpaceEnd asStringWithCommasSigned; nextPutAll: ' bytes'; cr.
>>        str     nextPutAll: '   young           ';
>>                nextPutAll: (youngSpaceEnd - oldSpaceEnd) asStringWithCommasSigned; nextPutAll: ' bytes'; cr.
>>        str     nextPutAll: '   used            ';
>>                nextPutAll: youngSpaceEnd asStringWithCommasSigned; nextPutAll: ' bytes'; cr.
>>        str     nextPutAll: '   free            ';
>>                nextPutAll: (memoryEnd - youngSpaceEnd) asStringWithCommasSigned; nextPutAll: ' bytes'; cr.
>> 
>>        str cr.
>>        str     nextPutAll: '**GCs**'; cr.
>>        str     nextPutAll: '   full                    ';
>> +               print: fullGCs; nextPutAll: ' totalling '; nextPutAll: fullGCTime asStringWithCommas; nextPutAll: ' ms (';
>> +               print: (fullGCTime / upTime * 100) maxDecimalPlaces: 2;
>> -               print: fullGCs; nextPutAll: ' totalling '; nextPutAll: fullGCTime asStringWithCommas; nextPutAll: 'ms (';
>> -               print: ((fullGCTime / upTime * 100) roundTo: 1.0);
>>                nextPutAll: '% uptime)'.
>>        fullGCs = 0 ifFalse:
>> +               [str    nextPutAll: ', avg '; print: (fullGCTime / fullGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'].
>> -               [str    nextPutAll: ', avg '; print: ((fullGCTime / fullGCs) roundTo: 1.0); nextPutAll: 'ms'].
>>        str     cr.
>> +       str     nextPutAll: '   incr                    ';
>> +               print: incrGCs; nextPutAll: ' totalling '; nextPutAll: incrGCTime asStringWithCommas; nextPutAll: ' ms (';
>> +               print: (incrGCTime / upTime * 100) maxDecimalPlaces: 1;
>> -       str     nextPutAll: '   incr            ';
>> -               print: incrGCs; nextPutAll: ' totalling '; nextPutAll: incrGCTime asStringWithCommas; nextPutAll: 'ms (';
>> -               print: ((incrGCTime / upTime * 100) roundTo: 1.0);
>>                nextPutAll: '% uptime)'.
>>        incrGCs = 0 ifFalse:
>> +               [str nextPutAll: ', avg '; print: (incrGCTime / incrGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'].
>> -               [str nextPutAll:', avg '; print: ((incrGCTime / incrGCs) roundTo: 1.0); nextPutAll: 'ms'].
>>        str cr.
>>        str     nextPutAll: '   tenures         ';
>>                nextPutAll: tenureCount asStringWithCommas.
>>        tenureCount = 0 ifFalse:
>> +               [str nextPutAll: ' (avg '; print: incrGCs // tenureCount; nextPutAll: ' GCs/tenure)'].
>> -               [str nextPutAll: ' (avg '; print: (incrGCs / tenureCount) asInteger; nextPutAll: ' GCs/tenure)'].
>>        str     cr.
>>        str     nextPutAll: '   root table      ';
>> +               nextPutAll: rootOverflows asStringWithCommas; nextPutAll: ' overflows'.
>> -               nextPutAll: rootOverflows asStringWithCommas; nextPutAll:' overflows'.
>>        str cr.
>>  !
>> 
>> Item was changed:
>>  ----- Method: SmalltalkImage>>vmStatisticsReportString (in category 'vm statistics') -----
>>  vmStatisticsReportString
>>        "StringHolderView open: (StringHolder new contents:
>>                SmalltalkImage current vmStatisticsReportString) label: 'VM Statistics'"
>> 
>>        | params oldSpaceEnd youngSpaceEnd memoryEnd fullGCs fullGCTime incrGCs incrGCTime tenureCount upTime upTime2 fullGCs2 fullGCTime2 incrGCs2 incrGCTime2 tenureCount2 str |
>>        params := self getVMParameters.
>>        oldSpaceEnd                     := params at: 1.
>>        youngSpaceEnd           := params at: 2.
>>        memoryEnd                       := 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: 1000).
>>        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             ';
>> -       str     nextPutAll: 'memory                     ';
>>                nextPutAll: memoryEnd asStringWithCommas; nextPutAll: ' bytes'; cr.
>>        str     nextPutAll:     '       old                     ';
>>                nextPutAll: oldSpaceEnd asStringWithCommas; nextPutAll: ' bytes (';
>> +               print: (oldSpaceEnd / memoryEnd * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
>> -               print: ((oldSpaceEnd / memoryEnd * 100) roundTo: 0.1); nextPutAll: '%)'; cr.
>>        str     nextPutAll: '   young           ';
>>                nextPutAll: (youngSpaceEnd - oldSpaceEnd) asStringWithCommas; nextPutAll: ' bytes (';
>> +               print: (youngSpaceEnd - oldSpaceEnd / memoryEnd * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
>> -               print: ((youngSpaceEnd - oldSpaceEnd / memoryEnd * 100) roundTo: 0.1); nextPutAll: '%)'; cr.
>>        str     nextPutAll: '   used            ';
>>                nextPutAll: youngSpaceEnd asStringWithCommas; nextPutAll: ' bytes (';
>> +               print: (youngSpaceEnd / memoryEnd * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
>> -               print: ((youngSpaceEnd / memoryEnd * 100) roundTo: 0.1); nextPutAll: '%)'; cr.
>>        str     nextPutAll: '   free            ';
>>                nextPutAll: (memoryEnd - youngSpaceEnd) asStringWithCommas; nextPutAll: ' bytes (';
>> +               print: (memoryEnd - youngSpaceEnd / memoryEnd * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
>> -               print: ((memoryEnd - youngSpaceEnd / memoryEnd * 100) roundTo: 0.1); nextPutAll: '%)'; cr.
>> 
>> +       str     nextPutAll: 'GCs                        ';
>> -       str     nextPutAll: 'GCs                                ';
>>                nextPutAll: (fullGCs + incrGCs) asStringWithCommas.
>>        fullGCs + incrGCs > 0 ifTrue: [
>>                str
>>                        nextPutAll: ' (';
>> +                       print: (upTime / (fullGCs + incrGCs)) maxDecimalPlaces: 1;
>> +                       nextPutAll: ' ms between GCs)'
>> -                       print: ((upTime / (fullGCs + incrGCs)) roundTo: 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;
>> -               print: fullGCs; nextPutAll: ' totalling '; nextPutAll: fullGCTime asStringWithCommas; nextPutAll: 'ms (';
>> -               print: ((fullGCTime / upTime * 100) roundTo: 1.0);
>>                nextPutAll: '% uptime)'.
>>        fullGCs = 0 ifFalse:
>> +               [str    nextPutAll: ', avg '; print: (fullGCTime / fullGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'].
>> -               [str    nextPutAll: ', avg '; print: ((fullGCTime / fullGCs) roundTo: 1.0); 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: '   incr            ';
>> -               print: incrGCs; nextPutAll: ' totalling '; nextPutAll: incrGCTime asStringWithCommas; nextPutAll: 'ms (';
>> -               print: ((incrGCTime / upTime * 100) roundTo: 1.0);
>> -               nextPutAll: '% uptime), avg '; print: ((incrGCTime / incrGCs) roundTo: 1.0); nextPutAll: 'ms'; cr.
>>        str     nextPutAll: '   tenures         ';
>>                nextPutAll: tenureCount asStringWithCommas.
>>        tenureCount = 0 ifFalse:
>> +               [str nextPutAll: ' (avg '; print: incrGCs // tenureCount; nextPutAll: ' GCs/tenure)'].
>> -               [str nextPutAll: ' (avg '; print: (incrGCs / tenureCount) asInteger; 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)'.
>> -                       print: ((upTime2 / (fullGCs2 + incrGCs2)) roundTo: 1);
>> -                       nextPutAll: 'ms between GCs)'.
>>        ].
>>        str cr.
>> +       str     nextPutAll: '   uptime          '; print: (upTime2 / 1000.0) maxDecimalPlaces: 1; nextPutAll: ' s'; cr.
>> -       str     nextPutAll: '   uptime          '; print: ((upTime2 / 1000.0) roundTo: 0.1); nextPutAll: 's'; cr.
>>        str     nextPutAll: '   full                    ';
>> +               nextPutAll: fullGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime2 asStringWithCommas; nextPutAll: ' ms (';
>> +               print: (fullGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;
>> -               print: fullGCs2; nextPutAll: ' totalling '; nextPutAll: fullGCTime2 asStringWithCommas; nextPutAll: 'ms (';
>> -               print: ((fullGCTime2 / upTime2 * 100) roundTo: 1.0);
>>                nextPutAll: '% uptime)'.
>>        fullGCs2 = 0 ifFalse:
>> +               [str    nextPutAll: ', avg '; print: (fullGCTime2 / fullGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'].
>> -               [str    nextPutAll: ', avg '; print: ((fullGCTime2 / fullGCs2) roundTo: 1.0); nextPutAll: 'ms'].
>>        str     cr.
>> +       str     nextPutAll: '   incr                    ';
>> +               nextPutAll: incrGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime2 asStringWithCommas; nextPutAll: ' ms (';
>> +               print: (incrGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;
>> -       str     nextPutAll: '   incr            ';
>> -               print: incrGCs2; nextPutAll: ' totalling '; nextPutAll: incrGCTime2 asStringWithCommas; nextPutAll: 'ms (';
>> -               print: ((incrGCTime2 / upTime2 * 100) roundTo: 1.0);
>>                nextPutAll: '% uptime), avg '.
>>        incrGCs2 > 0 ifTrue: [
>> +                str print: (incrGCTime2 / incrGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'
>> -                str print: ((incrGCTime2 / incrGCs2) roundTo: 1.0); nextPutAll: 'ms'
>>        ].
>>        str cr.
>>        str     nextPutAll: '   tenures         ';
>>                nextPutAll: tenureCount2 asStringWithCommas.
>>        tenureCount2 = 0 ifFalse:
>> +               [str nextPutAll: ' (avg '; print: incrGCs2 // tenureCount2; nextPutAll: ' GCs/tenure)'].
>> -               [str nextPutAll: ' (avg '; print: (incrGCs2 / tenureCount2) asInteger; 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
>>  !
>> 
>> 
> 





More information about the Squeak-dev mailing list