MemoryUsageView.st
changeset 9931 fe535606118f
parent 9930 010aad7911a2
child 9936 1090966171a4
equal deleted inserted replaced
9930:010aad7911a2 9931:fe535606118f
   513 
   513 
   514     "
   514     "
   515      special kludge
   515      special kludge
   516     "
   516     "
   517     class isSymbol ifTrue:[
   517     class isSymbol ifTrue:[
   518         class == #NameSpace ifFalse:[
   518         class == #NameSpace ifTrue:[
   519             ^ UserPreferences current systemBrowserClass open
   519             class := (Smalltalk at:class) class.
       
   520             insts := class allSubInstances.
       
   521             insts remove:class soleInstance ifAbsent:nil
       
   522         ] ifFalse:[
       
   523             class == #Metaclass ifTrue:[
       
   524                 insts := Metaclass allSubInstances.
       
   525             ] ifFalse:[
       
   526                 class == #Class ifTrue:[
       
   527                     insts := Class allSubInstances.
       
   528                 ] ifFalse:[
       
   529                     ^ self.
       
   530                 ].
       
   531             ]
   520         ].
   532         ].
   521         class := (Smalltalk at:class) class.
       
   522         insts := class allSubInstances.
       
   523         insts remove:class soleInstance ifAbsent:nil
       
   524     ] ifFalse:[
   533     ] ifFalse:[
   525         insts := class allInstances.
   534         insts := class allInstances.
   526     ].
   535     ].
   527     aBlock value:insts
   536     aBlock value:insts
   528 
   537 
   701                 entry instanceAllocationRate:deltaInstCount.
   710                 entry instanceAllocationRate:deltaInstCount.
   702                 entry memoryAllocationRate:deltaInstBytes.
   711                 entry memoryAllocationRate:deltaInstBytes.
   703             ].
   712             ].
   704         ].
   713         ].
   705         
   714         
   706         info := rawInfo asSortedCollection:sortBlock.
   715         info := (OrderedCollection withAll:rawInfo) sort:sortBlock.
   707 
   716 
   708         sumSizes := info collect:[:infoEntry | infoEntry overallByteSize ].
   717         sumSizes := info collect:[:infoEntry | infoEntry overallByteSize ].
   709         allMemory := sumSizes sum.
   718         allMemory := sumSizes sum.
   710         percents := sumSizes collect:[:sz | (sz asFloat / allMemory * 100)].
   719         percents := sumSizes collect:[:sz | (sz asFloat / allMemory * 100)].
   711         sumPercent := 0.
   720         sumPercent := 0.
   757         line := line , (overAllAvgSize printStringLeftPaddedTo:avgSizeLen).
   766         line := line , (overAllAvgSize printStringLeftPaddedTo:avgSizeLen).
   758         line := line , (overAllMaxSize printStringLeftPaddedTo:maxSizeLen).
   767         line := line , (overAllMaxSize printStringLeftPaddedTo:maxSizeLen).
   759         line := line , (100.0 printStringLeftPaddedTo:accumMemoryUseLen).
   768         line := line , (100.0 printStringLeftPaddedTo:accumMemoryUseLen).
   760         l addFirst:line.
   769         l addFirst:line.
   761 
   770 
       
   771         info addFirst:nil; addFirst:nil.
       
   772 
   762         list list:l.
   773         list list:l.
   763     ]
   774     ]
   764 
   775 
   765     "Created: / 19-09-1995 / 15:30:47 / claus"
   776     "Created: / 19-09-1995 / 15:30:47 / claus"
   766     "Modified: / 05-05-2011 / 17:15:29 / cg"
   777     "Modified: / 11-05-2011 / 14:47:52 / cg"
   767 !
   778 !
   768 
   779 
   769 updateInfo
   780 updateInfo
   770     "scan all memory and collect the information"
   781     "scan all memory and collect the information"
   771 
   782 
   973 ! !
   984 ! !
   974 
   985 
   975 !MemoryUsageView class methodsFor:'documentation'!
   986 !MemoryUsageView class methodsFor:'documentation'!
   976 
   987 
   977 version
   988 version
   978     ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.58 2011-05-11 12:40:06 cg Exp $'
   989     ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.59 2011-05-11 12:51:27 cg Exp $'
   979 !
   990 !
   980 
   991 
   981 version_CVS
   992 version_CVS
   982     ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.58 2011-05-11 12:40:06 cg Exp $'
   993     ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.59 2011-05-11 12:51:27 cg Exp $'
   983 ! !
   994 ! !