249 |
249 |
250 updateDisplay |
250 updateDisplay |
251 "update the displayed list" |
251 "update the displayed list" |
252 |
252 |
253 windowGroup withCursor:Cursor wait do:[ |
253 windowGroup withCursor:Cursor wait do:[ |
254 |classNames counts sumSizes maxSizes percents avgSizes |
254 |classNames counts sumSizes maxSizes percents avgSizes |
255 l line allMemory |
255 l line allMemory |
256 overAllCount overAllAvgSize overAllMaxSize| |
256 overAllCount overAllAvgSize overAllMaxSize| |
257 |
257 |
258 info := rawInfo asSortedCollection:sortBlock. |
258 info := rawInfo asSortedCollection:sortBlock. |
259 |
259 |
260 classNames := info collect:[:infoArray | |
260 classNames := info collect:[:infoArray | |
261 |cls| |
261 |cls| |
262 |
262 |
263 cls := infoArray at:1. |
263 cls := infoArray at:1. |
264 cls == Class ifTrue:[ |
264 cls == Class ifTrue:[ |
265 '<all classes>' |
265 '<all classes>' |
266 ] ifFalse:[ |
266 ] ifFalse:[ |
267 cls == Metaclass ifTrue:[ |
267 cls == Metaclass ifTrue:[ |
268 '<all metaclasses>' |
268 '<all metaclasses>' |
269 ] ifFalse:[ |
269 ] ifFalse:[ |
270 cls displayString "/name |
270 cls == PrivateMetaclass ifTrue:[ |
271 ] |
271 '<all private classes>' |
272 ] |
272 ] ifFalse:[ |
273 ]. |
273 cls displayString "/name |
274 |
274 ] |
275 counts := info collect:[:infoArray | (infoArray at:2) ]. |
275 ] |
276 sumSizes := info collect:[:infoArray | (infoArray at:3) ]. |
276 ] |
277 maxSizes := info collect:[:infoArray | (infoArray at:4) ]. |
277 ]. |
278 allMemory := sumSizes inject:0 into:[:sum :this | sum + this]. |
278 |
279 "/ allMemory := ObjectMemory bytesUsed. |
279 counts := info collect:[:infoArray | (infoArray at:2) ]. |
280 percents := sumSizes collect:[:sz | (sz asFloat / allMemory * 1000) rounded / 10.0]. |
280 sumSizes := info collect:[:infoArray | (infoArray at:3) ]. |
281 avgSizes := (1 to:sumSizes size) collect:[:i | (((sumSizes at:i) / (counts at:i)) * 10) rounded / 10.0]. |
281 maxSizes := info collect:[:infoArray | (infoArray at:4) ]. |
282 |
282 allMemory := sumSizes inject:0 into:[:sum :this | sum + this]. |
283 l := OrderedCollection new. |
283 "/ allMemory := ObjectMemory bytesUsed. |
284 1 to:classNames size do:[:i | |
284 percents := sumSizes collect:[:sz | (sz asFloat / allMemory * 1000) rounded / 10.0]. |
285 |line avgSz maxSz| |
285 avgSizes := (1 to:sumSizes size) collect:[:i | (((sumSizes at:i) / (counts at:i)) * 10) rounded / 10.0]. |
286 |
286 |
287 avgSz := avgSizes at:i. |
287 l := OrderedCollection new. |
288 maxSz := maxSizes at:i. |
288 1 to:classNames size do:[:i | |
289 avgSz = maxSz ifTrue:[ |
289 |line avgSz maxSz| |
290 avgSz := avgSz asInteger printString , ' '. |
290 |
291 ]. |
291 avgSz := avgSizes at:i. |
292 line := (classNames at:i) printStringPaddedTo:33 with:Character space. |
292 maxSz := maxSizes at:i. |
293 line := line , ((counts at:i) printStringLeftPaddedTo:7). |
293 avgSz = maxSz ifTrue:[ |
294 line := line , (avgSz printStringLeftPaddedTo:10). |
294 avgSz := avgSz asInteger printString , ' '. |
295 line := line , (maxSz printStringLeftPaddedTo:8). |
295 ]. |
296 line := line , ((sumSizes at:i) printStringLeftPaddedTo:10). |
296 line := (classNames at:i) printStringPaddedTo:33 with:Character space. |
297 line := line , ((percents at:i) printStringLeftPaddedTo:7). |
297 line := line , ((counts at:i) printStringLeftPaddedTo:7). |
298 l add:line |
298 line := line , (avgSz printStringLeftPaddedTo:10). |
299 ]. |
299 line := line , (maxSz printStringLeftPaddedTo:8). |
300 |
300 line := line , ((sumSizes at:i) printStringLeftPaddedTo:10). |
301 "add summary line" |
301 line := line , ((percents at:i) printStringLeftPaddedTo:7). |
302 overAllCount := counts inject:0 into:[:sum :this | sum + this]. |
302 l add:line |
303 overAllAvgSize := ((allMemory / overAllCount) * 10) rounded / 10.0. |
303 ]. |
304 overAllMaxSize := maxSizes max. |
304 |
305 |
305 "add summary line" |
306 l add:''. |
306 overAllCount := counts inject:0 into:[:sum :this | sum + this]. |
307 line := 'all objects' printStringPaddedTo:33 with:Character space. |
307 overAllAvgSize := ((allMemory / overAllCount) * 10) rounded / 10.0. |
308 line := line , (overAllCount printStringLeftPaddedTo:7). |
308 overAllMaxSize := maxSizes max. |
309 line := line , (overAllAvgSize printStringLeftPaddedTo:10). |
309 |
310 line := line , (overAllMaxSize printStringLeftPaddedTo:8). |
310 l add:''. |
311 line := line , (allMemory printStringLeftPaddedTo:10). |
311 line := 'all objects' printStringPaddedTo:33 with:Character space. |
312 line := line , (100.0 printStringLeftPaddedTo:7). |
312 line := line , (overAllCount printStringLeftPaddedTo:7). |
313 l add:line. |
313 line := line , (overAllAvgSize printStringLeftPaddedTo:10). |
314 |
314 line := line , (overAllMaxSize printStringLeftPaddedTo:8). |
315 list list:l. |
315 line := line , (allMemory printStringLeftPaddedTo:10). |
|
316 line := line , (100.0 printStringLeftPaddedTo:7). |
|
317 l add:line. |
|
318 |
|
319 list list:l. |
316 ] |
320 ] |
317 |
321 |
318 "Created: 19.9.1995 / 15:30:47 / claus" |
322 "Created: 19.9.1995 / 15:30:47 / claus" |
|
323 "Modified: 15.10.1996 / 21:59:36 / cg" |
319 ! |
324 ! |
320 |
325 |
321 updateInfo |
326 updateInfo |
322 "scan all memory and collect the information" |
327 "scan all memory and collect the information" |
323 |
328 |