MemoryMonitor.st
changeset 75 f6310cbc93b6
parent 68 b70257a99e48
child 79 d78f92a07d5d
equal deleted inserted replaced
74:f2c56efa3599 75:f6310cbc93b6
    22 
    22 
    23 MemoryMonitor comment:'
    23 MemoryMonitor comment:'
    24  COPYRIGHT (c) 1991 by Claus Gittinger
    24  COPYRIGHT (c) 1991 by Claus Gittinger
    25 	      All Rights Reserved
    25 	      All Rights Reserved
    26 
    26 
    27 $Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.9 1995-02-19 15:54:18 claus Exp $
    27 $Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.10 1995-03-06 19:31:50 claus Exp $
    28 '!
    28 '!
    29 
    29 
    30 !MemoryMonitor class methodsFor:'documentation'!
    30 !MemoryMonitor class methodsFor:'documentation'!
    31 
    31 
    32 copyright
    32 copyright
    43 "
    43 "
    44 !
    44 !
    45 
    45 
    46 version
    46 version
    47 "
    47 "
    48 $Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.9 1995-02-19 15:54:18 claus Exp $
    48 $Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.10 1995-03-06 19:31:50 claus Exp $
    49 "
    49 "
    50 !
    50 !
    51 
    51 
    52 documentation
    52 documentation
    53 "
    53 "
   293 "/    ].
   293 "/    ].
   294 
   294 
   295     y := y + fontHeight.
   295     y := y + fontHeight.
   296     n := ObjectMemory lastScavangeReclamation / ObjectMemory newSpaceSize * 100.0.
   296     n := ObjectMemory lastScavangeReclamation / ObjectMemory newSpaceSize * 100.0.
   297     n := 100 - n asInteger.
   297     n := 100 - n asInteger.
   298     s := (n printStringLeftPaddedTo:2) , '%'.
   298     s := (ObjectMemory scavengeCount printStringLeftPaddedTo:5)
       
   299 	 , (n printStringLeftPaddedTo:3) , '%'.
   299     self displayOpaqueString:s x:0 y:y.
   300     self displayOpaqueString:s x:0 y:y.
   300 !
   301 !
   301 
   302 
   302 updateDisplay
   303 updateDisplay
   303     "update picture; trigger next update"
   304     "update picture; trigger next update"
   504 	oldColor := Color white.
   505 	oldColor := Color white.
   505     ].
   506     ].
   506 
   507 
   507     self font:(Font family:'courier' face:'medium' style:'roman' size:10).
   508     self font:(Font family:'courier' face:'medium' style:'roman' size:10).
   508 
   509 
       
   510     self model:self.
       
   511     self menu:#memoryMenu
       
   512 
   509     "
   513     "
   510      MemoryMonitor open
   514      MemoryMonitor open
   511     "
   515     "
   512 !
   516 !
   513 
   517 
   514 initializeMiddleButtonMenu
   518 memoryMenu
   515     self middleButtonMenu:
   519     |labels selectors|
   516 	     (PopUpMenu labels:(resources array:#(
   520 
   517 						  'collect Garbage'
   521     labels :=    #(
   518 						  'collect Garbage & compress'
   522 		    'collect Garbage'
   519 						  '-'
   523 		    'collect Garbage & compress'
   520 						  'background collect'
   524 		    '-'
   521 						 ))
   525 		    'background collect'
   522 			selectors:#(
   526 		    '-'
   523 			    garbageCollect
   527 		    'compress sources '
   524 			    compressingGarbageCollect
   528 		  ).
   525 			    nil
   529 
   526 			    backgroundCollect
   530     selectors := #(
   527 			   )
   531 		    garbageCollect
       
   532 		    compressingGarbageCollect
       
   533 		    nil
       
   534 		    backgroundCollect
       
   535 		    nil
       
   536 		    compressSources
       
   537 		  ).
       
   538 
       
   539     ^ PopUpMenu labels:(resources array:labels)
       
   540 		 selectors:selectors
   528 		receiver:self
   541 		receiver:self
   529 		     for:self)
       
   530 ! !
   542 ! !
   531 
   543 
   532 !MemoryMonitor methodsFor:'menu functions'!
   544 !MemoryMonitor methodsFor:'menu functions'!
   533 
   545 
   534 garbageCollect
   546 garbageCollect
   539     ObjectMemory verboseGarbageCollect
   551     ObjectMemory verboseGarbageCollect
   540 !
   552 !
   541 
   553 
   542 backgroundCollect
   554 backgroundCollect
   543     [ObjectMemory incrementalGC] forkAt:4
   555     [ObjectMemory incrementalGC] forkAt:4
   544 ! !
   556 !
   545 
   557 
       
   558 compressSources
       
   559     Smalltalk compressSources.
       
   560     ObjectMemory markAndSweep
       
   561 ! !
       
   562