Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1203.mcz ==================== Summary ==================== Name: System-mt.1203 Author: mt Time: 18 December 2020, 1:00:34.958366 pm UUID: 1aa9ec9e-b39a-934f-9f81-1503c06477e5 Ancestors: System-mt.1202 SpaceTally again. Don't forget to count the space that is reachable from pools. But only do that after analysing class instances. And don't count things via pools that have already been counted via instance variables. =============== Diff against System-mt.1202 =============== Item was changed: ----- Method: SpaceTally>>computeSpaceUsage (in category 'class analysis') ----- computeSpaceUsage results do: [ :entry | + | class instanceSpaceAndCount seenObjects poolSpace | - | class instanceSpaceAndCount | class := self class environment at: entry analyzedClassName. Smalltalk garbageCollectMost. + seenObjects := self depth > 0 ifTrue: [IdentitySet new]. + instanceSpaceAndCount := self spaceForInstancesOf: class depth: self depth seen: seenObjects. + poolSpace := self spaceForPoolsOf: class depth: self depth seen: seenObjects. - instanceSpaceAndCount := self spaceForInstancesOf: class depth: self depth. entry codeSize: class spaceUsed; instanceCount: instanceSpaceAndCount second; spaceForInstances: instanceSpaceAndCount first; + spaceForPools: poolSpace first; depthOfSpace: self depth ] displayingProgress: 'Taking statistics...'! Item was added: + ----- Method: SpaceTally>>spaceForPoolsOf: (in category 'class analysis') ----- + spaceForPoolsOf: aClass + + ^ self spaceForPoolsOf: aClass depth: self depth! Item was added: + ----- Method: SpaceTally>>spaceForPoolsOf:depth: (in category 'class analysis') ----- + spaceForPoolsOf: aClass depth: anInteger + + ^ self spaceForPoolsOf: aClass depth: anInteger seen: (anInteger > 0 ifTrue: [IdentitySet new])! Item was added: + ----- Method: SpaceTally>>spaceForPoolsOf:depth:seen: (in category 'class analysis') ----- + spaceForPoolsOf: aClass depth: anInteger seen: seenObjects + + | pools objects total | + pools := {aClass classPool}, aClass sharedPools. + objects := pools gather: [:pool | pool values]. + objects isEmpty ifTrue: [^#(0 0)]. + total := 0. + objects do: [:each | total := total + (self spaceForInstance: each depth: anInteger seen: seenObjects)]. + ^{ total. objects size }! Item was changed: Object subclass: #SpaceTallyItem + instanceVariableNames: 'analyzedClassName codeSize instanceCount spaceForInstances spaceForPools depthOfSpace' - instanceVariableNames: 'analyzedClassName codeSize instanceCount spaceForInstances depthOfSpace' classVariableNames: '' poolDictionaries: '' category: 'System-Tools'! !SpaceTallyItem commentStamp: 'sd 6/20/2003 22:02' prior: 0! I'm represent an entry in the spaceTally.! Item was changed: ----- Method: SpaceTallyItem>>printOn: (in category 'printing') ----- printOn: aStream analyzedClassName ifNotNil: [ aStream nextPutAll: analyzedClassName asString]. aStream nextPutAll: ' ('. codeSize ifNotNil: [ aStream nextPutAll: 'code size: ' ; nextPutAll: codeSize asString]. instanceCount ifNotNil: [ aStream nextPutAll: ' instance count: ' ; nextPutAll: instanceCount asString]. spaceForInstances ifNotNil: [ aStream nextPutAll: ' space for instances: ' ; nextPutAll: spaceForInstances asBytesDescription]. + spaceForPools + ifNotNil: [ aStream nextPutAll: ' extra for pools: ' ; nextPutAll: spaceForPools asBytesDescription]. depthOfSpace ifNotNil: [ aStream nextPutAll: ' depth of space: ' ; nextPutAll: depthOfSpace asString]. aStream nextPut: $). ! Item was added: + ----- Method: SpaceTallyItem>>spaceForPools (in category 'accessing') ----- + spaceForPools + + ^ spaceForPools! Item was added: + ----- Method: SpaceTallyItem>>spaceForPools: (in category 'accessing') ----- + spaceForPools: aNumber + + spaceForPools := aNumber! |
Free forum by Nabble | Edit this page |