MemoryMonitorView.st
changeset 12407 689df530eb3c
parent 10574 c1b3570b7823
child 12408 c54a692c5e1f
equal deleted inserted replaced
12400:32a9d286d90f 12407:689df530eb3c
   109 !MemoryMonitorView methodsFor:'drawing'!
   109 !MemoryMonitorView methodsFor:'drawing'!
   110 
   110 
   111 displayKilo:aNumber name:nm y:y
   111 displayKilo:aNumber name:nm y:y
   112     |s|
   112     |s|
   113 
   113 
   114     aNumber >= (1024*1024*99) ifTrue:[
   114     aNumber >= (1024*1024*1024*2) ifTrue:[
   115         s := nm , ((aNumber // (1024*1024)) printStringLeftPaddedTo:5) , 'M '.
   115         s := nm , ((aNumber // (1024*1024*1024)) printStringLeftPaddedTo:5) , 'G '.
   116     ] ifFalse:[
   116     ] ifFalse:[
   117         s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '.
   117         aNumber >= (1024*1024*16) ifTrue:[
       
   118             s := nm , ((aNumber // (1024*1024)) printStringLeftPaddedTo:5) , 'M '.
       
   119         ] ifFalse:[
       
   120             s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '.
       
   121         ].
   118     ].
   122     ].
   119     self displayOpaqueString:s x:0 y:y.
   123     self displayOpaqueString:s x:0 y:y.
   120 
   124 
   121     "Modified: / 23.9.1998 / 13:19:04 / cg"
   125     "Modified: / 23.9.1998 / 13:19:04 / cg"
   122 !
   126 !
   330 
   334 
   331     |oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2
   335     |oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2
   332      mallocAllocated mallocTotal
   336      mallocAllocated mallocTotal
   333      codeUsed numWeak numRem numLifoRem tenureAge igcPhase 
   337      codeUsed numWeak numRem numLifoRem tenureAge igcPhase 
   334      minScavengeReclamation lastScavengeReclamation scavengeCount
   338      minScavengeReclamation lastScavengeReclamation scavengeCount
   335      y half s fontHeight fontDescent total n prevMallocAllocated prevMallocTotal|
   339      y half s fontHeight fontAscent fontDescent 
       
   340      limit total n prevMallocAllocated prevMallocTotal|
   336 
   341 
   337     oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
   342     oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
   338     newMemUsed := ObjectMemory newSpaceUsed.
   343     newMemUsed := ObjectMemory newSpaceUsed.
   339     freeMem := ObjectMemory freeListSpace.
   344     freeMem := ObjectMemory freeListSpace.
   340     oldSpaceSize := ObjectMemory oldSpaceSize + ObjectMemory symSpaceSize.
   345     oldSpaceSize := ObjectMemory oldSpaceSize + ObjectMemory symSpaceSize.
   341     newSpaceSize := ObjectMemory newSpaceSize.
   346     newSpaceSize := ObjectMemory newSpaceSize.
   342 
   347 
   343     mallocAllocated := ObjectMemory mallocAllocated.
   348     mallocAllocated := ObjectMemory mallocAllocated.
   344     mallocTotal := ObjectMemory mallocTotal.
   349     mallocTotal := ObjectMemory mallocTotal.
       
   350     limit := ObjectMemory maxOldSpace.
   345 
   351 
   346     memUsed := oldMemUsed + newMemUsed "- freeMem".
   352     memUsed := oldMemUsed + newMemUsed "- freeMem".
   347     total := oldSpaceSize + newSpaceSize.
   353     total := oldSpaceSize + newSpaceSize.
   348     free2 := ObjectMemory freeSpace.
   354     free2 := ObjectMemory freeSpace.
   349 
   355 
   350     self paint:White on:Black.
   356     self paint:White on:Black.
   351 
   357 
   352     fontDescent := font descent.
   358     fontDescent := font descent.
       
   359     fontAscent := font ascent.
   353     fontHeight := font height + fontDescent.
   360     fontHeight := font height + fontDescent.
   354     half := height // 2 + fontDescent.
   361     half := height // 2 + fontDescent.
   355 
   362 
   356     y := half - (fontHeight * 8).
   363     y := half - (fontHeight * 8).
   357 
   364 
   361         ].
   368         ].
   362         (total > maxTotal) ifTrue:[
   369         (total > maxTotal) ifTrue:[
   363             maxTotal := total.
   370             maxTotal := total.
   364         ].
   371         ].
   365 
   372 
   366         self displayKilo:maxTotal name:'max ' y:font ascent.
   373         self displayKilo:limit    name:'lim ' y:fontAscent.
   367         self displayKilo:minTotal name:'min ' y:(height - font descent).
   374         self displayKilo:maxTotal name:'max ' y:fontAscent + fontHeight.
       
   375         self displayKilo:minTotal name:'min ' y:(height - fontDescent).
   368         self displayKilo:total    name:'tot ' y:y.
   376         self displayKilo:total    name:'tot ' y:y.
   369 
   377 
   370         prevTotal := total.
   378         prevTotal := total.
   371     ].
   379     ].
   372 
   380 
  1018 ! !
  1026 ! !
  1019 
  1027 
  1020 !MemoryMonitorView class methodsFor:'documentation'!
  1028 !MemoryMonitorView class methodsFor:'documentation'!
  1021 
  1029 
  1022 version
  1030 version
  1023     ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitorView.st,v 1.16 2011-08-16 13:13:38 stefan Exp $'
  1031     ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitorView.st,v 1.17 2013-02-20 09:51:14 cg Exp $'
  1024 !
  1032 !
  1025 
  1033 
  1026 version_CVS
  1034 version_CVS
  1027     ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitorView.st,v 1.16 2011-08-16 13:13:38 stefan Exp $'
  1035     ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitorView.st,v 1.17 2013-02-20 09:51:14 cg Exp $'
  1028 ! !
  1036 ! !
       
  1037