MemMonitor.st
changeset 156 e6a7f80e2a71
parent 128 6eb4cc559360
child 157 77f56399cc5f
equal deleted inserted replaced
155:33c9fa03fc79 156:e6a7f80e2a71
    37 "
    37 "
    38 !
    38 !
    39 
    39 
    40 version
    40 version
    41 "
    41 "
    42 $Header: /cvs/stx/stx/libtool/Attic/MemMonitor.st,v 1.21 1995-08-30 18:36:02 claus Exp $
    42 $Header: /cvs/stx/stx/libtool/Attic/MemMonitor.st,v 1.22 1995-11-07 17:21:30 cg Exp $
    43 "
    43 "
    44 !
    44 !
    45 
    45 
    46 documentation
    46 documentation
    47 "
    47 "
   276 	tot:    total memory used (overall oldSpace + overall newSpace)
   276 	tot:    total memory used (overall oldSpace + overall newSpace)
   277 	all:    current memory in use (oldSpace + newSpace)
   277 	all:    current memory in use (oldSpace + newSpace)
   278 	new:    current newSpace in use
   278 	new:    current newSpace in use
   279 	free:   current size of freelist in oldSpace
   279 	free:   current size of freelist in oldSpace
   280 	old:    current oldSpace in use
   280 	old:    current oldSpace in use
   281 	minsc:  percent of newspace remaining after scavenge (worst case)
   281 	t:      current tenure age
   282 	t       current tenure age
   282 	I:      IGC state
   283 	I       IGC state
   283 	weak:   number of weak arrays in the system
   284 	rem     remembered set size
   284 	rem     remembered set size
   285 	lrem    lifo remembered set size
   285 	lrem    lifo remembered set size
   286 	count of scavenges
   286 	minsc:  percent of newspace remaining after scavenge (worst case)
   287 	last scavenge survivor rate
   287 	irq:    max. interrupt delay
       
   288 	count of scavenges / last scavenge survivor rate
       
   289 
   288     "
   290     "
   289 
   291 
   290     |oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2 
   292     |oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2 
   291      y half s fontHeight total n|
   293      y half s fontHeight total n|
   292 
   294 
   392     n := 100 - n asInteger.
   394     n := 100 - n asInteger.
   393     s := 'minSc ', (n printStringLeftPaddedTo:3) , '%'.
   395     s := 'minSc ', (n printStringLeftPaddedTo:3) , '%'.
   394     self displayOpaqueString:s x:0 y:y.
   396     self displayOpaqueString:s x:0 y:y.
   395 
   397 
   396     y := y + fontHeight.
   398     y := y + fontHeight.
       
   399     n := ObjectMemory maxInterruptDelay.
       
   400     n notNil ifTrue:[
       
   401 	s := 'irq ', (n printStringLeftPaddedTo:3) , ' ms'.
       
   402     ] ifFalse:[
       
   403 	s := 'irq ---'
       
   404     ].
       
   405     self displayOpaqueString:s x:0 y:y.
       
   406 
       
   407     y := y + fontHeight.
   397     n := ObjectMemory lastScavengeReclamation / ObjectMemory newSpaceSize * 100.0.
   408     n := ObjectMemory lastScavengeReclamation / ObjectMemory newSpaceSize * 100.0.
   398     n := 100 - n asInteger.
   409     n := 100 - n asInteger.
   399     s := (ObjectMemory scavengeCount printStringLeftPaddedTo:6)
   410     s := (ObjectMemory scavengeCount printStringLeftPaddedTo:6)
   400 	 , (n printStringLeftPaddedTo:3) , '%'.
   411 	 , (n printStringLeftPaddedTo:3) , '%'.
   401     self displayOpaqueString:s x:0 y:y.
   412     self displayOpaqueString:s x:0 y:y.
       
   413 
       
   414     "Created: 7.11.1995 / 14:48:16 / cg"
   402 !
   415 !
   403 
   416 
   404 redraw
   417 redraw
   405     "redraw all"
   418     "redraw all"
   406 
   419 
   470     ].
   483     ].
   471     key == $r ifTrue:[
   484     key == $r ifTrue:[
   472 	"reset max"
   485 	"reset max"
   473 	maxTotal := prevTotal.
   486 	maxTotal := prevTotal.
   474 	scale := height asFloat / (maxTotal + 100000).
   487 	scale := height asFloat / (maxTotal + 100000).
   475 	ObjectMemory resetMinScavengeReclamation.
   488 	self resetStatisticValues.
   476 	self redraw.
   489 	self redraw.
   477     ]
   490     ]
       
   491 
       
   492     "Modified: 7.11.1995 / 17:45:13 / cg"
   478 ! !
   493 ! !
   479 
   494 
   480 !MemoryMonitor methodsFor:'initialization'!
   495 !MemoryMonitor methodsFor:'initialization'!
   481 
   496 
   482 memoryMenu
   497 memoryMenu
   485     device ctrlDown ifTrue:[
   500     device ctrlDown ifTrue:[
   486 	labels :=    #(
   501 	labels :=    #(
   487 			'scavenge'
   502 			'scavenge'
   488 			'tenure'
   503 			'tenure'
   489 			'incremental collect'
   504 			'incremental collect'
       
   505 			'reset statistic values'
   490 			'-'
   506 			'-'
   491 			'cleanup memory'
   507 			'cleanup memory'
   492 			'-'
   508 			'-'
   493 			'compress sources'
   509 			'compress sources'
   494 		      ).
   510 		      ).
   495 	selectors := #(
   511 	selectors := #(
   496 			scavenge
   512 			scavenge
   497 			tenure
   513 			tenure
   498 			incrementalCollect
   514 			incrementalCollect
       
   515 			resetStatisticValues
   499 			nil
   516 			nil
   500 			cleanupMemory
   517 			cleanupMemory
   501 			nil
   518 			nil
   502 			compressSources
   519 			compressSources
   503 		      ).
   520 		      ).
   607      finally, compress
   624      finally, compress
   608     "
   625     "
   609     ObjectMemory verboseGarbageCollect.
   626     ObjectMemory verboseGarbageCollect.
   610 !
   627 !
   611 
   628 
       
   629 resetStatisticValues 
       
   630     ObjectMemory resetMaxDelay.
       
   631     ObjectMemory resetMinScavengeReclamation.
       
   632 
       
   633     "Created: 7.11.1995 / 17:44:59 / cg"
       
   634 !
       
   635 
   612 garbageCollect
   636 garbageCollect
   613     ObjectMemory markAndSweep
   637     ObjectMemory markAndSweep
   614 !
   638 !
   615 
   639 
   616 garbageCollectAndSymbols
   640 garbageCollectAndSymbols