MemoryMonitor.st
changeset 1012 e3793f355ffc
parent 994 1734123c7520
child 1052 81d87e3e1d14
equal deleted inserted replaced
1011:1022e80a1c60 1012:e3793f355ffc
   198 
   198 
   199 updateDisplay
   199 updateDisplay
   200     "update picture; trigger next update"
   200     "update picture; trigger next update"
   201 
   201 
   202     |total oldSpaceUsed newSpaceUsed freeMem oldSpaceSize
   202     |total oldSpaceUsed newSpaceUsed freeMem oldSpaceSize
   203      gWidth shift scaleChange margin mustWait|
   203      gWidth shift scaleChange margin|
   204 
   204 
   205     shown ifTrue:[
   205     shown ifTrue:[
   206         drawLock wouldBlock ifFalse:[
   206         drawLock wouldBlock ifFalse:[
   207             drawLock critical:[
   207             drawLock critical:[
   208                 oldSpaceUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
   208                 oldSpaceUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
   233                 ].
   233                 ].
   234 
   234 
   235                 gWidth := width - org.
   235                 gWidth := width - org.
   236                 margin := 1.
   236                 margin := 1.
   237 
   237 
   238                 mustWait := false.
       
   239                 ((updateIndex-1) >= (gWidth - margin)) ifTrue:[
   238                 ((updateIndex-1) >= (gWidth - margin)) ifTrue:[
   240         "on slow displays, use:"
   239         "on slow displays, use:"
   241         "/            shift := gWidth // 4.
   240         "/            shift := gWidth // 4.
   242 
   241 
   243         "for smooth display, use:"
   242         "for smooth display, use:"
   248                     freeData replaceFrom:1 with:freeData startingAt:shift+1.
   247                     freeData replaceFrom:1 with:freeData startingAt:shift+1.
   249 
   248 
   250                     updateIndex := updateIndex - shift.
   249                     updateIndex := updateIndex - shift.
   251                     dX := dX + shift.
   250                     dX := dX + shift.
   252 
   251 
   253                     self catchExpose.
       
   254                     self copyFrom:self 
   252                     self copyFrom:self 
   255                                 x:(org + shift) y:0
   253                                 x:(org + shift) y:0
   256                               toX:org y:0
   254                               toX:org y:0
   257                             width:(gWidth - shift - margin)
   255                             width:(gWidth - shift - margin)
   258                            height:height.
   256                            height:height.
       
   257 
   259                     self clearRectangleX:(width - margin - shift) y:0 
   258                     self clearRectangleX:(width - margin - shift) y:0 
   260                                    width:shift height:height.
   259                                    width:shift height:height.
   261                     mustWait := true.
       
   262                 ].
   260                 ].
   263 
   261 
   264                 self updateLineX:(updateIndex - 1 + org - 1)
   262                 self updateLineX:(updateIndex - 1 + org - 1)
   265                            total:total 
   263                            total:total 
   266                            old:oldSpaceSize "/ oldSpaceUsed
   264                            old:oldSpaceSize "/ oldSpaceUsed
   267                            new:newSpaceUsed 
   265                            new:newSpaceUsed 
   268                            free:freeMem.
   266                            free:freeMem.
   269 
   267 
   270                 self updateNumbers.
   268                 self updateNumbers.
   271                 self flush.
   269                 self flush.
   272 
       
   273                 mustWait ifTrue:[
       
   274                     self waitForExpose.
       
   275                 ]
       
   276 
       
   277             ].
   270             ].
   278         ].
   271         ].
   279     ].
   272     ].
   280 
   273 
   281     updateBlock notNil ifTrue:[
   274     updateBlock notNil ifTrue:[
   282         Processor addTimedBlock:updateBlock afterSeconds:updateInterval
   275         Processor addTimedBlock:updateBlock afterSeconds:updateInterval
   283     ].
   276     ].
   284 
   277 
   285     "Modified: 23.1.1997 / 22:38:08 / cg"
   278     "Modified: 29.1.1997 / 13:32:31 / cg"
   286 !
   279 !
   287 
   280 
   288 updateLineX:x total:total old:oldSpaceSize new:newSpaceUsed free:freeMem
   281 updateLineX:x total:total old:oldSpaceSize new:newSpaceUsed free:freeMem
   289     |hNew hOld hFree y1 y2 y3|
   282     |hNew hOld hFree y1 y2 y3|
   290 
   283 
   855 ! !
   848 ! !
   856 
   849 
   857 !MemoryMonitor class methodsFor:'documentation'!
   850 !MemoryMonitor class methodsFor:'documentation'!
   858 
   851 
   859 version
   852 version
   860     ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.42 1997-01-24 22:23:40 cg Exp $'
   853     ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.43 1997-01-29 12:33:14 cg Exp $'
   861 ! !
   854 ! !