# HG changeset patch # User Claus Gittinger # Date 845413396 -7200 # Node ID 56ecc821f8bec5c5ec022307c8bc449941b1c895 # Parent c74bce2106aeed9d5c4c5b5394a4d7ff227c1530 checkin from browser diff -r c74bce2106ae -r 56ecc821f8be MemUsageV.st --- a/MemUsageV.st Tue Oct 15 21:45:11 1996 +0200 +++ b/MemUsageV.st Tue Oct 15 23:03:16 1996 +0200 @@ -17,7 +17,7 @@ category:'Interface-Tools' ! -!MemoryUsageView class methodsFor:'documentation'! +!MemoryUsageView class methodsFor:'documentation'! copyright " @@ -251,71 +251,76 @@ "update the displayed list" windowGroup withCursor:Cursor wait do:[ - |classNames counts sumSizes maxSizes percents avgSizes - l line allMemory - overAllCount overAllAvgSize overAllMaxSize| + |classNames counts sumSizes maxSizes percents avgSizes + l line allMemory + overAllCount overAllAvgSize overAllMaxSize| - info := rawInfo asSortedCollection:sortBlock. + info := rawInfo asSortedCollection:sortBlock. - classNames := info collect:[:infoArray | - |cls| + classNames := info collect:[:infoArray | + |cls| - cls := infoArray at:1. - cls == Class ifTrue:[ - '' - ] ifFalse:[ - cls == Metaclass ifTrue:[ - '' - ] ifFalse:[ - cls displayString "/name - ] - ] - ]. + cls := infoArray at:1. + cls == Class ifTrue:[ + '' + ] ifFalse:[ + cls == Metaclass ifTrue:[ + '' + ] ifFalse:[ + cls == PrivateMetaclass ifTrue:[ + '' + ] ifFalse:[ + cls displayString "/name + ] + ] + ] + ]. - counts := info collect:[:infoArray | (infoArray at:2) ]. - sumSizes := info collect:[:infoArray | (infoArray at:3) ]. - maxSizes := info collect:[:infoArray | (infoArray at:4) ]. - allMemory := sumSizes inject:0 into:[:sum :this | sum + this]. - "/ allMemory := ObjectMemory bytesUsed. - percents := sumSizes collect:[:sz | (sz asFloat / allMemory * 1000) rounded / 10.0]. - avgSizes := (1 to:sumSizes size) collect:[:i | (((sumSizes at:i) / (counts at:i)) * 10) rounded / 10.0]. + counts := info collect:[:infoArray | (infoArray at:2) ]. + sumSizes := info collect:[:infoArray | (infoArray at:3) ]. + maxSizes := info collect:[:infoArray | (infoArray at:4) ]. + allMemory := sumSizes inject:0 into:[:sum :this | sum + this]. + "/ allMemory := ObjectMemory bytesUsed. + percents := sumSizes collect:[:sz | (sz asFloat / allMemory * 1000) rounded / 10.0]. + avgSizes := (1 to:sumSizes size) collect:[:i | (((sumSizes at:i) / (counts at:i)) * 10) rounded / 10.0]. - l := OrderedCollection new. - 1 to:classNames size do:[:i | - |line avgSz maxSz| + l := OrderedCollection new. + 1 to:classNames size do:[:i | + |line avgSz maxSz| - avgSz := avgSizes at:i. - maxSz := maxSizes at:i. - avgSz = maxSz ifTrue:[ - avgSz := avgSz asInteger printString , ' '. - ]. - line := (classNames at:i) printStringPaddedTo:33 with:Character space. - line := line , ((counts at:i) printStringLeftPaddedTo:7). - line := line , (avgSz printStringLeftPaddedTo:10). - line := line , (maxSz printStringLeftPaddedTo:8). - line := line , ((sumSizes at:i) printStringLeftPaddedTo:10). - line := line , ((percents at:i) printStringLeftPaddedTo:7). - l add:line - ]. + avgSz := avgSizes at:i. + maxSz := maxSizes at:i. + avgSz = maxSz ifTrue:[ + avgSz := avgSz asInteger printString , ' '. + ]. + line := (classNames at:i) printStringPaddedTo:33 with:Character space. + line := line , ((counts at:i) printStringLeftPaddedTo:7). + line := line , (avgSz printStringLeftPaddedTo:10). + line := line , (maxSz printStringLeftPaddedTo:8). + line := line , ((sumSizes at:i) printStringLeftPaddedTo:10). + line := line , ((percents at:i) printStringLeftPaddedTo:7). + l add:line + ]. - "add summary line" - overAllCount := counts inject:0 into:[:sum :this | sum + this]. - overAllAvgSize := ((allMemory / overAllCount) * 10) rounded / 10.0. - overAllMaxSize := maxSizes max. + "add summary line" + overAllCount := counts inject:0 into:[:sum :this | sum + this]. + overAllAvgSize := ((allMemory / overAllCount) * 10) rounded / 10.0. + overAllMaxSize := maxSizes max. - l add:''. - line := 'all objects' printStringPaddedTo:33 with:Character space. - line := line , (overAllCount printStringLeftPaddedTo:7). - line := line , (overAllAvgSize printStringLeftPaddedTo:10). - line := line , (overAllMaxSize printStringLeftPaddedTo:8). - line := line , (allMemory printStringLeftPaddedTo:10). - line := line , (100.0 printStringLeftPaddedTo:7). - l add:line. + l add:''. + line := 'all objects' printStringPaddedTo:33 with:Character space. + line := line , (overAllCount printStringLeftPaddedTo:7). + line := line , (overAllAvgSize printStringLeftPaddedTo:10). + line := line , (overAllMaxSize printStringLeftPaddedTo:8). + line := line , (allMemory printStringLeftPaddedTo:10). + line := line , (100.0 printStringLeftPaddedTo:7). + l add:line. - list list:l. + list list:l. ] "Created: 19.9.1995 / 15:30:47 / claus" + "Modified: 15.10.1996 / 21:59:36 / cg" ! updateInfo @@ -347,12 +352,21 @@ (class flags bitAnd:behaviorFlag) ~~ 0 ifTrue:[ o isObsolete ifFalse:[ o isMeta ifTrue:[ - class := Metaclass + o isPrivate ifTrue:[ + class := PrivateMetaclass + ] ifFalse:[ + class := Metaclass + ] ] ifFalse:[ - class := Class +"/ o isPrivate ifTrue:[ +"/ class := PrivateMetaclass +"/ ] ifFalse:[ + class := Class +"/ ] ] ] ]. + bytes := ObjectMemory sizeOf:o. infoArray := rawInfo at:class ifAbsent:[]. infoArray isNil ifTrue:[ @@ -374,6 +388,7 @@ ] "Modified: 19.9.1995 / 15:29:10 / claus" + "Modified: 15.10.1996 / 22:02:00 / cg" ! ! !MemoryUsageView methodsFor:'realization'! @@ -384,8 +399,8 @@ self sortByClass. ! ! -!MemoryUsageView class methodsFor:'documentation'! +!MemoryUsageView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/Attic/MemUsageV.st,v 1.16 1996-06-28 13:46:05 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/Attic/MemUsageV.st,v 1.17 1996-10-15 21:03:16 cg Exp $' ! ! diff -r c74bce2106ae -r 56ecc821f8be MemoryUsageView.st --- a/MemoryUsageView.st Tue Oct 15 21:45:11 1996 +0200 +++ b/MemoryUsageView.st Tue Oct 15 23:03:16 1996 +0200 @@ -17,7 +17,7 @@ category:'Interface-Tools' ! -!MemoryUsageView class methodsFor:'documentation'! +!MemoryUsageView class methodsFor:'documentation'! copyright " @@ -251,71 +251,76 @@ "update the displayed list" windowGroup withCursor:Cursor wait do:[ - |classNames counts sumSizes maxSizes percents avgSizes - l line allMemory - overAllCount overAllAvgSize overAllMaxSize| + |classNames counts sumSizes maxSizes percents avgSizes + l line allMemory + overAllCount overAllAvgSize overAllMaxSize| - info := rawInfo asSortedCollection:sortBlock. + info := rawInfo asSortedCollection:sortBlock. - classNames := info collect:[:infoArray | - |cls| + classNames := info collect:[:infoArray | + |cls| - cls := infoArray at:1. - cls == Class ifTrue:[ - '' - ] ifFalse:[ - cls == Metaclass ifTrue:[ - '' - ] ifFalse:[ - cls displayString "/name - ] - ] - ]. + cls := infoArray at:1. + cls == Class ifTrue:[ + '' + ] ifFalse:[ + cls == Metaclass ifTrue:[ + '' + ] ifFalse:[ + cls == PrivateMetaclass ifTrue:[ + '' + ] ifFalse:[ + cls displayString "/name + ] + ] + ] + ]. - counts := info collect:[:infoArray | (infoArray at:2) ]. - sumSizes := info collect:[:infoArray | (infoArray at:3) ]. - maxSizes := info collect:[:infoArray | (infoArray at:4) ]. - allMemory := sumSizes inject:0 into:[:sum :this | sum + this]. - "/ allMemory := ObjectMemory bytesUsed. - percents := sumSizes collect:[:sz | (sz asFloat / allMemory * 1000) rounded / 10.0]. - avgSizes := (1 to:sumSizes size) collect:[:i | (((sumSizes at:i) / (counts at:i)) * 10) rounded / 10.0]. + counts := info collect:[:infoArray | (infoArray at:2) ]. + sumSizes := info collect:[:infoArray | (infoArray at:3) ]. + maxSizes := info collect:[:infoArray | (infoArray at:4) ]. + allMemory := sumSizes inject:0 into:[:sum :this | sum + this]. + "/ allMemory := ObjectMemory bytesUsed. + percents := sumSizes collect:[:sz | (sz asFloat / allMemory * 1000) rounded / 10.0]. + avgSizes := (1 to:sumSizes size) collect:[:i | (((sumSizes at:i) / (counts at:i)) * 10) rounded / 10.0]. - l := OrderedCollection new. - 1 to:classNames size do:[:i | - |line avgSz maxSz| + l := OrderedCollection new. + 1 to:classNames size do:[:i | + |line avgSz maxSz| - avgSz := avgSizes at:i. - maxSz := maxSizes at:i. - avgSz = maxSz ifTrue:[ - avgSz := avgSz asInteger printString , ' '. - ]. - line := (classNames at:i) printStringPaddedTo:33 with:Character space. - line := line , ((counts at:i) printStringLeftPaddedTo:7). - line := line , (avgSz printStringLeftPaddedTo:10). - line := line , (maxSz printStringLeftPaddedTo:8). - line := line , ((sumSizes at:i) printStringLeftPaddedTo:10). - line := line , ((percents at:i) printStringLeftPaddedTo:7). - l add:line - ]. + avgSz := avgSizes at:i. + maxSz := maxSizes at:i. + avgSz = maxSz ifTrue:[ + avgSz := avgSz asInteger printString , ' '. + ]. + line := (classNames at:i) printStringPaddedTo:33 with:Character space. + line := line , ((counts at:i) printStringLeftPaddedTo:7). + line := line , (avgSz printStringLeftPaddedTo:10). + line := line , (maxSz printStringLeftPaddedTo:8). + line := line , ((sumSizes at:i) printStringLeftPaddedTo:10). + line := line , ((percents at:i) printStringLeftPaddedTo:7). + l add:line + ]. - "add summary line" - overAllCount := counts inject:0 into:[:sum :this | sum + this]. - overAllAvgSize := ((allMemory / overAllCount) * 10) rounded / 10.0. - overAllMaxSize := maxSizes max. + "add summary line" + overAllCount := counts inject:0 into:[:sum :this | sum + this]. + overAllAvgSize := ((allMemory / overAllCount) * 10) rounded / 10.0. + overAllMaxSize := maxSizes max. - l add:''. - line := 'all objects' printStringPaddedTo:33 with:Character space. - line := line , (overAllCount printStringLeftPaddedTo:7). - line := line , (overAllAvgSize printStringLeftPaddedTo:10). - line := line , (overAllMaxSize printStringLeftPaddedTo:8). - line := line , (allMemory printStringLeftPaddedTo:10). - line := line , (100.0 printStringLeftPaddedTo:7). - l add:line. + l add:''. + line := 'all objects' printStringPaddedTo:33 with:Character space. + line := line , (overAllCount printStringLeftPaddedTo:7). + line := line , (overAllAvgSize printStringLeftPaddedTo:10). + line := line , (overAllMaxSize printStringLeftPaddedTo:8). + line := line , (allMemory printStringLeftPaddedTo:10). + line := line , (100.0 printStringLeftPaddedTo:7). + l add:line. - list list:l. + list list:l. ] "Created: 19.9.1995 / 15:30:47 / claus" + "Modified: 15.10.1996 / 21:59:36 / cg" ! updateInfo @@ -347,12 +352,21 @@ (class flags bitAnd:behaviorFlag) ~~ 0 ifTrue:[ o isObsolete ifFalse:[ o isMeta ifTrue:[ - class := Metaclass + o isPrivate ifTrue:[ + class := PrivateMetaclass + ] ifFalse:[ + class := Metaclass + ] ] ifFalse:[ - class := Class +"/ o isPrivate ifTrue:[ +"/ class := PrivateMetaclass +"/ ] ifFalse:[ + class := Class +"/ ] ] ] ]. + bytes := ObjectMemory sizeOf:o. infoArray := rawInfo at:class ifAbsent:[]. infoArray isNil ifTrue:[ @@ -374,6 +388,7 @@ ] "Modified: 19.9.1995 / 15:29:10 / claus" + "Modified: 15.10.1996 / 22:02:00 / cg" ! ! !MemoryUsageView methodsFor:'realization'! @@ -384,8 +399,8 @@ self sortByClass. ! ! -!MemoryUsageView class methodsFor:'documentation'! +!MemoryUsageView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.16 1996-06-28 13:46:05 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.17 1996-10-15 21:03:16 cg Exp $' ! !