MemoryMonitorView.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 04:00:37 +0200
changeset 18220 d1ebaddf1100
parent 17779 ca9754553cca
child 19547 63ae485b071a
permissions -rw-r--r--
#UI_ENHANCEMENT by cg class: Tools::CheckinInfoDialog class changed: #windowSpec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
3173
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
    12
"{ Package: 'stx:libtool' }"
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
    13
16091
mawalch
parents: 13960
diff changeset
    14
"{ NameSpace: Smalltalk }"
mawalch
parents: 13960
diff changeset
    15
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
View subclass:#MemoryMonitorView
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'updateInterval updateBlock myProcess oldData newData freeData
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
		updateIndex org maxTotal minTotal dX newColor freeColor oldColor
12408
c54a692c5e1f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12407
diff changeset
    19
		prevTotal prevLimit prevFree prevFree2 prevOld scale drawLock
c54a692c5e1f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12407
diff changeset
    20
		prevMemUsed prevCodeUsed prevNumWeak prevNumRem prevNumLifoRem
c54a692c5e1f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12407
diff changeset
    21
		prevTenureAge prevIGCPhase prevLastScavengeReclamation
17013
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
    22
		prevMinScavengeReclamation prevScavengeCount mallocColor
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
    23
		drawAction'
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
	classVariableNames:''
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
	poolDictionaries:''
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
	category:'Monitors-ST/X'
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
!MemoryMonitorView class methodsFor:'documentation'!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
copyright
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 COPYRIGHT (c) 1991 by Claus Gittinger
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
	      All Rights Reserved
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 This software is furnished under a license and may be used
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 only in accordance with the terms of that license and with the
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 inclusion of the above copyright notice.   This software may not
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
 be provided or otherwise made available to, or used by, any
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
 other person.  No title to or ownership of the software is
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
 hereby transferred.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
documentation
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    Shows memory usage (oldspace + newspace). Simple, but useful.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    The numbers shown are:
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
        tot     total memory usage (i.e. allocated oldSpace + allocated newSpace)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
                (does not include the second semispace and other help-areas,
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
                 such as the remembered set etc.)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
        all     current oldSpace in use + newSpace in use
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
        new     current newSpace in use
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
        frl     free space in (fragmented) free lists
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
        fre     compact free area above the used oldSpace
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
        old     current oldSpace in use
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
10574
c1b3570b7823 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 10573
diff changeset
    63
        mal     memory used by malloc (netto)
c1b3570b7823 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 10573
diff changeset
    64
c1b3570b7823 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 10573
diff changeset
    65
        mto     total memory that has been reserved by the malloc subsystem
c1b3570b7823 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 10573
diff changeset
    66
                (may contained mem that has been freed or not yet allocated)
c1b3570b7823 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 10573
diff changeset
    67
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
        cod     dynamic compiled code space size (just in time compiler)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
        max,    extreme values of 'tot' since the monitor started
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
        min     (can be reset by typing 'r' in the view)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
        t       tenure threshold (1 .. 30)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
        I       incremental GC state (2 = idle)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
        weak    number of weak objects
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
        rem     size of rememberedSet
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
        minsc:  percent of newspace remaining after scavenge (worst case)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
                (i.e. the minimum %% of scavenged objects)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
        count   number of scavenges since system started
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
        %       percentage of live objects in newSpace after last scavenge
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
                (i.e. this is the garbage vs. living objects ratio of
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
                 newSpace objects after the last scavenge)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    the graphic shows:
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
        orange  newSpace used
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
        green   free memory in freeLists
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
        white   oldSpace used
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    the popupMenu offers GC functions; keyboard options are:
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
        'f' -> faster; 's' -> slower; 'r' -> reset min/max
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
17013
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
    99
    Disclaimer:
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   100
        this was one of the first tools written for ST/X (around 1989/90);
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   101
        today, it would probably be written differently...
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   102
        
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    [author:]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
        Claus Gittinger
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    [start with:]
2367
51653f206d55 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2363
diff changeset
   107
        MemoryMonitor open
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
        MemoryMonitorView open
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    [see also:]
2367
51653f206d55 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2363
diff changeset
   111
        ObjectMemory MemoryMonitor
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
        MemoryUsageMonitor ProcessMonitor
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
! !
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
!MemoryMonitorView methodsFor:'drawing'!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
displayKilo:aNumber name:nm y:y
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    |s|
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
17779
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   121
    false ifTrue:[
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   122
        s := nm , (UnitConverter fileSizeStringFor:aNumber).
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    ] ifFalse:[
17779
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   124
        aNumber >= (1024*1024*1024*8) ifTrue:[
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   125
            s := nm , ((aNumber // (1024*1024*1024)) printStringLeftPaddedTo:5) , 'G '.
12407
689df530eb3c class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 10574
diff changeset
   126
        ] ifFalse:[
17779
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   127
            aNumber >= (1024*1024*16) ifTrue:[
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   128
                s := nm , ((aNumber // (1024*1024)) printStringLeftPaddedTo:5) , 'M '.
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   129
            ] ifFalse:[
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   130
                s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '.
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   131
            ].
12407
689df530eb3c class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 10574
diff changeset
   132
        ].
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
17779
ca9754553cca #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
   136
    "Modified: / 22-11-2017 / 21:44:41 / cg"
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
17013
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   139
initializeDrawAction
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   140
    "extracted into a separate block to avoid memory allocation in updateDisplay"
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   141
    
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   142
    drawAction :=
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   143
        [    
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   144
            |total oldSpaceUsed newSpaceUsed freeMem oldSpaceSize
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   145
             realOldSpaceSize symSpaceSize realOldSpaceUsed
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   146
             gWidth shift scaleChange margin|
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   147
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   148
            realOldSpaceSize := ObjectMemory oldSpaceSize.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   149
            symSpaceSize := ObjectMemory symSpaceSize.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   150
            realOldSpaceUsed := ObjectMemory oldSpaceUsed.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   151
            
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   152
            oldSpaceUsed := realOldSpaceUsed + ObjectMemory symSpaceUsed.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   153
            newSpaceUsed := ObjectMemory newSpaceUsed.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   154
            freeMem := ObjectMemory freeListSpace + (realOldSpaceSize - realOldSpaceUsed).
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   155
            oldSpaceSize := realOldSpaceSize + symSpaceSize.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   156
            total := oldSpaceSize + ObjectMemory newSpaceSize.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   157
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   158
            scaleChange := false.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   159
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   160
            ((total - freeMem) < minTotal) ifTrue:[
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   161
                minTotal := total - freeMem.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   162
                scaleChange := true
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   163
            ].
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   164
            (total > maxTotal) ifTrue:[
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   165
                maxTotal := total.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   166
                scaleChange := true
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   167
            ].
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   168
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   169
            oldData at:updateIndex put:oldSpaceSize. "/ oldSpaceUsed.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   170
            newData at:updateIndex put:newSpaceUsed.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   171
            freeData at:updateIndex put:freeMem.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   172
            updateIndex := updateIndex + 1.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   173
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   174
            scaleChange ifTrue:[
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   175
                scale := height asFloat / (maxTotal + 100000).
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   176
                self redraw
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   177
            ].
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   178
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   179
            gWidth := width - org.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   180
            margin := 1.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   181
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   182
            ((updateIndex-1) >= (gWidth - margin)) ifTrue:[
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   183
                "on slow displays, use:"
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   184
                "/            shift := gWidth // 4.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   185
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   186
                "for smooth display, use:"
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   187
                shift := 1.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   188
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   189
                oldData replaceFrom:1 with:oldData startingAt:shift+1.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   190
                newData replaceFrom:1 with:newData startingAt:shift+1.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   191
                freeData replaceFrom:1 with:freeData startingAt:shift+1.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   192
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   193
                updateIndex := updateIndex - shift.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   194
                dX := (dX ? 0) + shift.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   195
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   196
                "/ before copying, handle any outstanding exposes ...
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   197
                self repairDamage.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   198
                "/ self catchExpose.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   199
                self 
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   200
                    copyFrom:self 
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   201
                    x:(org + shift) y:0 toX:org y:0
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   202
                    width:(gWidth - shift - margin) height:height
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   203
                    async:false.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   204
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   205
                self 
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   206
                    clearRectangleX:(width - margin - shift) y:0 
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   207
                    width:shift height:height.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   208
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   209
                "/ self waitForExpose.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   210
            ].
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   211
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   212
            self 
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   213
                updateLineX:(updateIndex - 1 + org - 1)
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   214
                total:total 
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   215
                old:oldSpaceSize "/ oldSpaceUsed
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   216
                new:newSpaceUsed 
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   217
                free:freeMem.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   218
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   219
            self updateNumbers.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   220
            self flush.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   221
        ].
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   222
!
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   223
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
redraw
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
    "redraw all"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    self clear.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    self redrawX:0 y:0 width:width height:height
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
redrawX:x y:y width:w height:h
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    "redraw data"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    |total oldSpaceUsed newSpaceUsed freeMem lx startIdx endIdx
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
     right|
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
    shown ifFalse:[^ self].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
    right := x + w - 1.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    right >= org ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
        lx := x.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
        lx < org ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
            lx := org
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
        ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
        total := ObjectMemory symSpaceSize 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
                 + ObjectMemory oldSpaceSize 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
                 + ObjectMemory newSpaceSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
        startIdx := (lx-org+1).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
        startIdx < 1 ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
            startIdx := 1
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
        ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
        endIdx := right-org+1.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
        endIdx >= updateIndex ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
            endIdx := updateIndex-1.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
        ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
        dX := 0.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
        startIdx to:endIdx do:[:i |
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
            newSpaceUsed := newData at:i.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
            newSpaceUsed notNil ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
                oldSpaceUsed := oldData at:i.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
                freeMem := freeData at:i.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
                self updateLineX:lx - dX
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
                       total:total 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
                       old:oldSpaceUsed 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
                       new:newSpaceUsed 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
                       free:freeMem.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
            ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
            lx := lx + 1
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
        ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
    x < org ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
        "/ force redraw.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
12408
c54a692c5e1f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12407
diff changeset
   280
        prevFree := prevFree2 := prevOld := prevTotal := prevLimit := nil.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
        prevMemUsed := prevCodeUsed := prevNumWeak := prevNumRem := nil.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
        prevNumLifoRem := prevTenureAge := prevIGCPhase := nil.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
        prevLastScavengeReclamation := prevMinScavengeReclamation := nil.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
        prevScavengeCount := nil.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
        self updateNumbers.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    "Modified: / 14.7.1998 / 23:33:47 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
updateDisplay
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
    "update picture; trigger next update"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
    shown ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
        drawLock wouldBlock ifFalse:[
17013
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   297
            drawLock critical:drawAction.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
        ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
    updateBlock notNil ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
        Processor addTimedBlock:updateBlock afterSeconds:updateInterval
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
    "Modified: / 5.8.1998 / 13:13:18 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
updateLineX:x total:total old:oldSpaceSize new:newSpaceUsed free:freeMem
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
    |hNew hOld hFree y1 y2 y3|
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
    hNew := (newSpaceUsed * scale) asInteger.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
    hOld := (oldSpaceSize * scale) // 2.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    hFree := (freeMem * scale) // 2.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
    y1 := height - 1.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    y2 := y1 - hOld.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
    self paint:oldColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    self displayLineFromX:x y:y1 toX:x y:y2.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
    y3 := y1 - hFree.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    self paint:freeColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    self displayLineFromX:x y:y1 toX:x y:y3.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
    y1 := y2 - hNew.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
    y1 ~= y2 ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
       self paint:newColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
       self displayLineFromX:x y:y1 toX:x y:y2.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
    ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    "Modified: / 29.1.1999 / 20:45:07 / stefan"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
updateNumbers
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
    "redraw numbers.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
     The values shown are:
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
        max:    maximum memory used since monitor started
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
        min:    minimum memory used since monitor started
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
        tot:    total memory used (overall oldSpace + overall newSpace)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
        all:    current memory in use (oldSpace + newSpace)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
        new:    current newSpace in use
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
        fre:    current size of freelist in oldSpace
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
        old:    current oldSpace in use
12731
8613dbe2831f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
   344
        mal:    net allocated by malloc
10570
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   345
        mto:    brutto memory reserved by malloc
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
        code:   current just-in-time compiled code cache size
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
        t:      current tenure age
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
        I:      IGC state
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
        weak:   number of weak arrays in the system
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
        rem     remembered set size
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
        lrem    lifo remembered set size
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
        minsc:  percent of newspace remaining after scavenge (worst case)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
        irq:    max. interrupt delay
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
        count of scavenges / last scavenge survivor rate
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
10570
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   358
    |oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   359
     mallocAllocated mallocTotal
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
     codeUsed numWeak numRem numLifoRem tenureAge igcPhase 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
     minScavengeReclamation lastScavengeReclamation scavengeCount
17013
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   362
     y half s font fontHeight fontAscent fontDescent 
12407
689df530eb3c class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 10574
diff changeset
   363
     limit total n prevMallocAllocated prevMallocTotal|
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
    oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
    newMemUsed := ObjectMemory newSpaceUsed.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
    freeMem := ObjectMemory freeListSpace.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
    oldSpaceSize := ObjectMemory oldSpaceSize + ObjectMemory symSpaceSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
    newSpaceSize := ObjectMemory newSpaceSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
10570
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   371
    mallocAllocated := ObjectMemory mallocAllocated.
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   372
    mallocTotal := ObjectMemory mallocTotal.
12407
689df530eb3c class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 10574
diff changeset
   373
    limit := ObjectMemory maxOldSpace.
10570
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   374
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
    memUsed := oldMemUsed + newMemUsed "- freeMem".
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
    total := oldSpaceSize + newSpaceSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
    free2 := ObjectMemory freeSpace.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
13959
a1126eb2fcfd class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13957
diff changeset
   379
    self paint:self whiteColor on:self blackColor.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
17013
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   381
    font := gc font.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   382
    fontDescent := font descent.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   383
    fontAscent := font ascent.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   384
    fontHeight := font height + fontDescent.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
    half := height // 2 + fontDescent.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
10573
afd99a8655e8 changed: #updateNumbers
Stefan Vogel <sv@exept.de>
parents: 10570
diff changeset
   387
    y := half - (fontHeight * 8).
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
12408
c54a692c5e1f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12407
diff changeset
   389
    limit ~~ prevLimit ifTrue:[
c54a692c5e1f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12407
diff changeset
   390
        self displayKilo:limit    name:'lim ' y:fontAscent.
c54a692c5e1f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12407
diff changeset
   391
        prevLimit := limit.
c54a692c5e1f class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12407
diff changeset
   392
    ].
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
    total ~~ prevTotal ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
        ((total - freeMem) < minTotal) ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
            minTotal := total - freeMem.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
        ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
        (total > maxTotal) ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
            maxTotal := total.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
        ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
12407
689df530eb3c class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 10574
diff changeset
   401
        self displayKilo:maxTotal name:'max ' y:fontAscent + fontHeight.
689df530eb3c class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 10574
diff changeset
   402
        self displayKilo:minTotal name:'min ' y:(height - fontDescent).
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
        self displayKilo:total    name:'tot ' y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
        prevTotal := total.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
    memUsed ~~ prevMemUsed ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
        self displayKilo:memUsed name:'all ' y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
        prevMemUsed := memUsed.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
    self paint:newColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
    self displayKilo:newMemUsed name:'new ' y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
    freeMem ~~ prevFree ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
        self paint:freeColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
        self displayKilo:freeMem name:'frl ' y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
        prevFree := freeMem.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
    free2 ~~ prevFree2 ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
        self paint:freeColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
        self displayKilo:free2 name:'fre ' y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
        prevFree2 := free2.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
    (oldMemUsed - freeMem) ~~ prevOld ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
        self paint:oldColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
        self displayKilo:(oldMemUsed - freeMem) name:'old ' y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
        prevOld := (oldMemUsed - freeMem).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
    y := y + fontHeight.
10570
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   440
    mallocAllocated ~~ prevMallocAllocated ifTrue:[
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   441
        self paint:mallocColor.
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   442
        self displayKilo:mallocAllocated name:'mal ' y:y.
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   443
        prevMallocAllocated := mallocAllocated.
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   444
    ].
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   445
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   446
    y := y + fontHeight.
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   447
    mallocTotal ~~ prevMallocTotal ifTrue:[
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   448
        self paint:mallocColor.
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   449
        self displayKilo:mallocTotal name:'mto ' y:y.
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   450
        prevMallocTotal := mallocTotal.
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   451
    ].
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   452
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   453
    y := y + fontHeight.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
    ObjectMemory supportsJustInTimeCompilation ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
        codeUsed := ObjectMemory compiledCodeSpaceUsed.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
        prevCodeUsed ~~ codeUsed ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
            self paint:oldColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
            codeUsed > 9999 ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
                s := 'code ' , ((codeUsed // 1024) printStringLeftPaddedTo:4) , 'k'.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
            ] ifFalse:[
10573
afd99a8655e8 changed: #updateNumbers
Stefan Vogel <sv@exept.de>
parents: 10570
diff changeset
   461
                s := 'code ' , (codeUsed printStringLeftPaddedTo:4) , 'b'.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
            ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
            self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
            prevCodeUsed := codeUsed.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
        ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
     the following is internal - normally only interesting when debugging the VM
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
    tenureAge := ObjectMemory tenureAge.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
    igcPhase := ObjectMemory incrementalGCPhase.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
    (prevTenureAge ~~ tenureAge
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
    or:[prevIGCPhase ~~ igcPhase]) ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
        self paint:oldColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
        s := 't:' , (tenureAge printStringLeftPaddedTo:2) , ' '.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
        s := s , ' I:' , (igcPhase printStringLeftPaddedTo:2) , ' '.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
        self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
        prevTenureAge := tenureAge.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
        prevIGCPhase := igcPhase.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
    numWeak := ObjectMemory numberOfWeakObjects.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    prevNumWeak ~~ numWeak ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
        self paint:oldColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
        s := 'weak: ' , (numWeak printStringLeftPaddedTo:4).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
        self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
        prevNumWeak := numWeak.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
    numRem := ObjectMemory rememberedSetSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
    prevNumRem ~~ numRem ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
        self paint:oldColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
        s := 'rem: ' , (numRem printStringLeftPaddedTo:5).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
        self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
        prevNumRem := numRem.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
    numLifoRem := ObjectMemory lifoRememberedSetSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
    prevNumLifoRem ~~ numLifoRem ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
        self paint:oldColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
        s := 'lrem: ' , (numLifoRem printStringLeftPaddedTo:4 ifLarger:['****']).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
        self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
        prevNumLifoRem := numLifoRem.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
"/ does no longer make sense to show ....
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
"/    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
"/    ObjectMemory runsSingleOldSpace ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
"/        self displayOpaqueString:'single' x:0 y:(half + (fontHeight*4)).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
"/    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
    minScavengeReclamation := ObjectMemory minScavengeReclamation * 100 // ObjectMemory newSpaceSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
    prevMinScavengeReclamation ~~ minScavengeReclamation ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
        minScavengeReclamation := 100 - minScavengeReclamation asInteger.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
        s := 'minSc ', (minScavengeReclamation printStringLeftPaddedTo:3) , '%'.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
        self paint:oldColor.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
        self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
        prevMinScavengeReclamation := minScavengeReclamation.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    n := ObjectMemory maxInterruptLatency.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
    n notNil ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
        s := 'irq ', (n printStringLeftPaddedTo:3) , ' ms'.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
    ] ifFalse:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
        s := ''
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
    self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
    y := y + fontHeight.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
    scavengeCount := ObjectMemory scavengeCount.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
    lastScavengeReclamation := ObjectMemory lastScavengeReclamation * 100 // ObjectMemory newSpaceSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
    (prevScavengeCount ~~ scavengeCount
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
    or:[prevLastScavengeReclamation ~~ lastScavengeReclamation]) ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
        lastScavengeReclamation := 100 - lastScavengeReclamation asInteger.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
        s := (scavengeCount printStringLeftPaddedTo:6)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
             , (lastScavengeReclamation printStringLeftPaddedTo:3) , '%'.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
        self displayOpaqueString:s x:0 y:y.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
        prevLastScavengeReclamation := lastScavengeReclamation.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
        prevScavengeCount := scavengeCount.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
    "Created: / 7.11.1995 / 14:48:16 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
    "Modified: / 14.7.1998 / 23:35:53 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
! !
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
!MemoryMonitorView methodsFor:'events'!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
keyPress:key x:x y:y
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
    key == $f ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
	"faster"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
	updateInterval := updateInterval / 2
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
    key == $s ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
	"slower"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
	updateInterval := updateInterval * 2
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
    key == $r ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
	"reset max"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
	maxTotal := prevTotal.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
	scale := height asFloat / (maxTotal + 100000).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
	self resetStatisticValues.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
	self redraw.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
    ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
    "Modified: 7.11.1995 / 17:45:13 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
sizeChanged:how
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
    |nn no nf delta oldSize newSize|
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   578
    super sizeChanged:how.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
    (width == 0 or:[height == 0]) ifTrue:[
2369
e0164ab47abd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2367
diff changeset
   581
        ^ self
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
    oldSize := oldData size.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
    newSize := width-org+1.
2369
e0164ab47abd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2367
diff changeset
   586
    newSize <= 0 ifTrue:[^ self].
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
    (newSize ~~ oldSize) ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
        nn := Array new:newSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
        no := Array new:newSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
        nf := Array new:newSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
        (newSize > oldSize) ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
            nn replaceFrom:1 to:oldSize with:newData.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
            no replaceFrom:1 to:oldSize with:oldData.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
            nf replaceFrom:1 to:oldSize with:freeData
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
        ] ifFalse:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
            delta := (oldSize - newSize).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
            nn replaceFrom:1 with:newData startingAt:delta+1.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
            no replaceFrom:1 with:oldData startingAt:delta+1.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
            nf replaceFrom:1 with:freeData startingAt:delta+1.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
            updateIndex > newSize ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
                updateIndex := updateIndex - delta.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
            ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
        ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
        newData := nn.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
        oldData := no.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
        freeData := nf.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
        scale := height asFloat / (maxTotal + 100000).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
    self clear.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
    self redraw.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
    "Modified: / 7.9.1998 / 21:41:13 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
! !
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
6297
01b5be803287 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4975
diff changeset
   618
!MemoryMonitorView methodsFor:'initialization & release'!
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
destroy
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
    updateBlock notNil ifTrue:[
2370
453caa0c1907 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
   622
        Processor removeTimedBlock:updateBlock.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
    ] ifFalse:[
2370
453caa0c1907 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
   624
        myProcess notNil ifTrue:[
453caa0c1907 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
   625
            myProcess terminate.
453caa0c1907 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
   626
            myProcess := nil
453caa0c1907 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
   627
        ]
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
    oldData := newData := freeData := nil.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
    super destroy
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
initialize
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
    super initialize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
17013
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   636
    self initializeDrawAction.
cf59893a8693 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16743
diff changeset
   637
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
    drawLock := Semaphore forMutualExclusion name:'drawLock'.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
    updateInterval := 0.5.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
    ProcessorScheduler isPureEventDriven ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
        updateBlock := [self updateDisplay].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
    oldData := Array new:1000.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
    newData := Array new:1000.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
    freeData := Array new:1000.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
    updateIndex := 1.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
16251
4a0adeeff6df class: Image
Claus Gittinger <cg@exept.de>
parents: 16242
diff changeset
   650
    self font:((Font family:'courier' face:'medium' style:'roman' size:10) onDevice:device).
13957
f7064863060e class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13756
diff changeset
   651
    org := gc font widthOf:'max 99999k '.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
    level := 0.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
    maxTotal := minTotal := ObjectMemory oldSpaceSize 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
                            + ObjectMemory symSpaceSize
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
                            + ObjectMemory newSpaceSize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
13960
d3e937384107 class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13959
diff changeset
   658
    viewBackground := self blackColor.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
16242
b44620e65044 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 16091
diff changeset
   660
    device hasColors ifTrue:[
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
        newColor := Color orange. "/ yellow.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
        freeColor := Color green.
10570
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   663
        mallocColor := Color yellow.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
    ] ifFalse:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
        newColor := Color grey:67.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
        freeColor := Color grey:33.
10570
b11a0023bac8 - Add malloc counts
Stefan Vogel <sv@exept.de>
parents: 10384
diff changeset
   667
        mallocColor := Color grey:50.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
    ].
16743
539e6058dba1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 16251
diff changeset
   669
    oldColor := self whiteColor.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
    self model:self.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
    self menu:#memoryMenu
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
     MemoryMonitor open
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
10384
a29a99b6ecf8 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 9542
diff changeset
   678
    "Modified: / 24-07-2011 / 08:28:51 / cg"
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
realize
13957
f7064863060e class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13756
diff changeset
   682
    |graphicsDevice|
f7064863060e class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13756
diff changeset
   683
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
    super realize.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
    updateBlock notNil ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
        Processor addTimedBlock:updateBlock afterSeconds:updateInterval.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
    ] ifFalse:[
8655
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   688
        (myProcess isNil or:[myProcess isDead]) ifTrue:[
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   689
            myProcess := [
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   690
                [
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   691
                    self updateProcess
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   692
                ] ensure:[
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   693
                    myProcess := nil.
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   694
                ].
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   695
            ] newProcess.
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   696
            myProcess priorityRange:(6 to:8).
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   697
            myProcess name:'monitor [' , 
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   698
                           Processor activeProcessId printString ,
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   699
                           '] update'.
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   700
            myProcess restartable:true.
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   701
            myProcess resume.
c79fd17ad0a1 check for myProcess not nil
ca
parents: 8650
diff changeset
   702
        ].
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
16242
b44620e65044 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 16091
diff changeset
   705
    graphicsDevice := device.
13957
f7064863060e class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13756
diff changeset
   706
    newColor := newColor onDevice:graphicsDevice.
f7064863060e class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13756
diff changeset
   707
    freeColor := freeColor onDevice:graphicsDevice.
f7064863060e class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13756
diff changeset
   708
    oldColor := oldColor onDevice:graphicsDevice.
f7064863060e class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13756
diff changeset
   709
    mallocColor := mallocColor onDevice:graphicsDevice.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
    "Modified: / 23.9.1998 / 12:41:10 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   714
reinitStyle
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
    "ignore style changes"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
    "Created: / 15.9.1998 / 15:22:46 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
! !
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
!MemoryMonitorView methodsFor:'menu functions'!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   722
backgroundCollect
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
    "start a background (non disturbing) incremental GC. 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   724
     Since the GC is performed at a low priority, it may not make progress if higher
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   725
     prio processes are running"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   726
 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   727
    [
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   728
	ObjectMemory incrementalGC
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
    ] forkAt:5 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
backgroundCollectWithDynamicPrio
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
    "setup the background collector to run at dynamic priority.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
     This is a new experimental feature."
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
    Processor isTimeSlicing ifFalse:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
        Processor startTimeSlicing.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   738
        Processor supportDynamicPriorities:true
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   741
    ObjectMemory backgroundCollectProcess priorityRange:(5 to:9).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   742
    ObjectMemory backgroundFinalizationProcess priorityRange:(5 to:9).
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   743
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   744
    "Modified: / 4.8.1998 / 02:16:02 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   746
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
backgroundCollectWithFixPrio
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
    "setup the background collector to run at a fix priority.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
     This is the default."
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
    ObjectMemory backgroundCollectProcess priorityRange:nil.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
    ObjectMemory backgroundFinalizationProcess priorityRange:nil.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   753
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   754
    "Modified: / 4.8.1998 / 02:00:31 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   755
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
cleanupMemory
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
    "let all classes release unneeded, cached
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
     data ..."
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
    ObjectMemory performLowSpaceCleanup.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
     then, perform a GC (incl. symbol reclamation)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
    ObjectMemory reclaimSymbols.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
     finally, compress
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
    "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
    ObjectMemory tenure.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
    ObjectMemory verboseGarbageCollect.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
    "Modified: 26.6.1997 / 17:12:53 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
cleanupMethodHistory
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
    "release the oldMethod history"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
    (self confirm:'This removes the previous method history,
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
which is kept for all changed methods in the system.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
After that, the browsers cannot easily switch back to a methods
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
previous version.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
However, this is normally not a problem, since
16091
mawalch
parents: 13960
diff changeset
   785
a methods previous code should still be accessible through
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
either the changes-file, the sourceCode repository or the classes original
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
source file.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
cleanup now ?') ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
        Class flushMethodHistory.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
        "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
         then, perform a GC (incl. symbol reclamation)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
        "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
        ObjectMemory reclaimSymbols.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
        "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
         finally, compress
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
        "
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
        ObjectMemory verboseGarbageCollect.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
   ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
collectGarbage
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
    "perform a blocking (non compressing) garbage collect"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
    windowGroup withWaitCursorDo:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
        ObjectMemory tenure.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
        ObjectMemory markAndSweep
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
    ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
    "Modified: 30.7.1997 / 21:19:35 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
collectGarbageAndCompress
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
    "perform a blocking compressing garbage collect."
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
    windowGroup withWaitCursorDo:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
        ObjectMemory tenure.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
        ObjectMemory verboseGarbageCollect
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
    ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
    "Modified: 30.7.1997 / 21:19:47 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
collectGarbageAndSymbols
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
    "perform a blocking (non compressing) garbage collect
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
     and reclaim unreferenced symbols."
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
    windowGroup withWaitCursorDo:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
        ObjectMemory tenure.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
        ObjectMemory reclaimSymbols
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
    ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
    "Modified: 30.7.1997 / 21:19:41 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
13755
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   839
compressOldSpace
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   840
    "perform a blocking compress (only useful if freeList is not empty, after M&S)"
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   841
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   842
    windowGroup withWaitCursorDo:[
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   843
        ObjectMemory compressOldSpace.
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   844
    ]
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   845
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   846
    "Modified: 30.7.1997 / 21:19:35 / cg"
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   847
!
fd2d7ea464b0 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 12731
diff changeset
   848
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
compressSources
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
    (self confirm:'This saves all in-memory source strings into a file
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
and makes methods reference these (file-) strings,
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
freeing all in-memory sources.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
If that source file is ever lost or gets out of sync with
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
your system, those method sources are lost and the browser
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
will show garbage. 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
However, you still have a change file as backup.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
(Be especially careful, if you move images around:
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
 the source file must then be the correct one for that image)
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
A compress is only useful, if you added many methods
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
and the systems response time suffers from paging.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
Compress anyway ?') ifTrue:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
        windowGroup withWaitCursorDo:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
            Smalltalk compressSources.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
            ObjectMemory markAndSweep
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
        ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
    ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
    "Modified: 9.2.1996 / 18:17:22 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
incrementalCollect
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   876
    "start an incremental GC which does not disturb too much, but is guaranteed to
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   877
     make progress.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
     This is done by doing the IGC at a very high priority, but giving up the CPU after
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   879
     every step. Due to the long delays, this may take a while to finish.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   880
     Notice, that this is different from doing a background collect: that one
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
     may not make any progress if higher prio processes are runnable."
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   882
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
    |done delay|
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
    [
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
        done := false.
17434
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
   887
        delay := Delay forMilliseconds:10.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
        [done] whileFalse:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   889
            10 timesRepeat:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
                done ifFalse:[done := ObjectMemory gcStep].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
            ].
17434
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
   892
            delay wait.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
        ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
    ] forkAt:Processor highestPriority
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
17434
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
   896
    "Modified: / 23-12-1995 / 17:31:55 / cg"
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
   897
    "Modified: / 23-02-2017 / 14:00:57 / stefan"
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
8650
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   900
memoryMenu
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   901
    <resource: #programMenu>
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   902
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   903
    |hasSpecialMenu m items moreItems specialMenu|
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   904
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   905
    hasSpecialMenu := Smalltalk isStandAloneApp not.
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   906
    hasSpecialMenu ifTrue:[
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   907
        items := #(
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   908
                    ('Background Collect Now'       backgroundCollect)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   909
                    ('Hi Prio Incremental Collect'  incrementalCollect)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   910
                    ('-')
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   911
                    ('Scavenge'                     scavenge)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   912
                    ('Tenure'                       tenure)
13756
0fdbb4b1c1e3 class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 13755
diff changeset
   913
                    ('Compress Only'                compressOldSpace)
8650
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   914
                    ('-')
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   915
                    ('Cleanup Memory'               cleanupMemory)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   916
                    ('Flush Method History'         cleanupMethodHistory)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   917
                    ('Unload Autoloaded Classes'    unloadAllAutoloadedClasses)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   918
                    ('-')
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   919
                    ('Compress Sources'             compressSources)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   920
                  ).
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   921
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   922
        ObjectMemory backgroundCollectorRunning ifFalse:[
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   923
            moreItems := #(
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   924
                        ('Start Background Collector'   restartBackgroundCollector )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   925
                     ) 
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   926
        ] ifTrue:[
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   927
            (ObjectMemory backgroundCollectProcess priorityRange notNil)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   928
            ifTrue:[
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   929
                moreItems := #(
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   930
                        ('Stop Background Collector'             stopBackgroundCollector      )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   931
                        ('Background Collect with Fix Priority'  backgroundCollectWithFixPrio )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   932
                         ) 
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   933
            ] ifFalse:[
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   934
                moreItems := #(
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   935
                        ('Stop Background Collector'                stopBackgroundCollector      )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   936
                        ('Background Collect with Dynamic Priority' backgroundCollectWithDynamicPrio )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   937
                         ) 
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   938
            ].
9542
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
   939
            ObjectMemory backgroundFinalizationProcess isNil ifTrue:[
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
   940
                moreItems := moreItems , #(
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
   941
                            ('Start Background Finalizer'   restartBackgroundFinalizer )
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
   942
                         )
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
   943
            ].
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
   944
8650
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   945
        ].
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   946
        items := moreItems , items.
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   947
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   948
        specialMenu := PopUpMenu
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   949
                            itemList:items
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   950
                            resources:resources.
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   951
13957
f7064863060e class: MemoryMonitorView
Stefan Vogel <sv@exept.de>
parents: 13756
diff changeset
   952
        self sensor ctrlDown ifTrue:[
8650
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   953
            ^ specialMenu
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   954
        ].
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   955
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   956
        items := #(
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   957
                    ('Collect Garbage'              collectGarbage                  )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   958
                    ('Collect Garbage & Symbols'    collectGarbageAndSymbols        )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   959
                    ('Collect Garbage & Compress'   collectGarbageAndCompress       )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   960
                    ('-')                                                           
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   961
                    ('Reset Statistic Values'       resetStatisticValues            )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   962
                    ('-')
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   963
                    ('Others'                       otherMenu                       Ctrl)
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   964
                  ).
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   965
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   966
        m := PopUpMenu itemList:items resources:resources.
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   967
        m subMenuAt:#otherMenu put:specialMenu.
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   968
    ] ifFalse:[
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   969
        items := #(
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   970
                    ('Collect Garbage'              collectGarbage                  )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   971
                    ('Collect Garbage & Symbols'    collectGarbageAndSymbols        )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   972
                    ('Collect Garbage & Compress'   collectGarbageAndCompress       )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   973
                    ('-')                                                           
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   974
                    ('Reset Statistic Values'       resetStatisticValues            )
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   975
                  ).
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   976
        m := PopUpMenu itemList:items resources:resources.
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   977
    ].
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   978
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   979
    ^ m
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   980
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   981
    "Modified: / 5.8.1998 / 15:35:14 / cg"
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   982
!
9c4626c21c7b do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   983
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   984
resetStatisticValues 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   985
    ObjectMemory resetMaxInterruptLatency.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   986
    ObjectMemory resetMinScavengeReclamation.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   987
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   988
    "Created: 7.11.1995 / 17:44:59 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   991
restartBackgroundCollector
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   992
    "(re)start a background (non disturbing) incremental GC. 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   993
     Since the GC is performed at a low priority, it may not make progress if higher
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
     prio processes are running"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   995
 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   996
    ObjectMemory backgroundCollectorRunning
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   997
    ifFalse:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   998
        ObjectMemory startBackgroundCollectorAt:5.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   999
        ObjectMemory startBackgroundFinalizationAt:5
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1000
    ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1001
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
    "Created: / 21.1.1997 / 00:09:30 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
    "Modified: / 5.8.1998 / 14:30:17 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1004
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
9542
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1006
restartBackgroundFinalizer
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1007
    "(re)start a background (non disturbing) incremental finalizer process."
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1008
 
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1009
    ObjectMemory backgroundFinalizationProcess isNil
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1010
    ifTrue:[
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1011
        ObjectMemory startBackgroundFinalizationAt:5
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1012
    ]
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1013
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1014
    "Created: / 21.1.1997 / 00:09:30 / cg"
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1015
    "Modified: / 5.8.1998 / 14:30:17 / cg"
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1016
!
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1017
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1018
scavenge 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1019
    "perform a blocking newspace garbage collect.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1020
     (this is for debugging only - the system does this automatically)"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1021
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1022
    ObjectMemory scavenge
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1023
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1024
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1025
stopBackgroundCollector
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
    "stop the background (non disturbing) incremental GC. 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
     We do not recommend this - but maybe useful for debugging and
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1028
     evaluating the programs behavior in heavy-load situations
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1029
     (background collector cannot keep up with the allocation rate)"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1030
 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1031
    ObjectMemory stopBackgroundCollector.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1032
    ObjectMemory stopBackgroundFinalization
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1033
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1034
    "Created: / 5.8.1998 / 14:29:40 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1035
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1036
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1037
tenure 
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1038
    "empty the newSpace, by aging all new objects immediately and transfering them
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1039
     into oldSpace.
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
     (this is for debugging only - the system does this automatically)"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1041
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1042
    ObjectMemory tenure
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1043
!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1044
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1045
unloadAllAutoloadedClasses
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1046
    "unload all classes which were autoloaded and have no instances"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1047
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1048
    Autoload loadedClasses copy do:[:anAutoloadedClass |
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1049
        anAutoloadedClass hasInstances ifFalse:[
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1050
            anAutoloadedClass unload
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1051
        ]
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1052
    ].
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1053
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1054
    "Created: 27.6.1997 / 14:21:45 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1055
    "Modified: 27.6.1997 / 14:22:47 / cg"
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1056
! !
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1057
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1058
!MemoryMonitorView methodsFor:'private'!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1059
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1060
updateProcess
17434
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
  1061
    |delay|
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
  1062
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
  1063
    delay := Delay forSeconds:updateInterval.
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
  1064
    [
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
  1065
        delay wait.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1066
        self updateDisplay
17434
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
  1067
    ] loop.
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1068
17434
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
  1069
    "Modified: / 23-09-1998 / 12:40:31 / cg"
bfd610008561 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 17013
diff changeset
  1070
    "Modified: / 23-02-2017 / 14:02:01 / stefan"
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1071
! !
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1072
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1073
!MemoryMonitorView class methodsFor:'documentation'!
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1074
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1075
version
16091
mawalch
parents: 13960
diff changeset
  1076
    ^ '$Header$'
9542
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1077
!
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1078
279e4be4e515 added: #restartBackgroundFinalizer
sr
parents: 8655
diff changeset
  1079
version_CVS
16091
mawalch
parents: 13960
diff changeset
  1080
    ^ '$Header$'
2363
7b5e7b24ba17 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1081
! !
12407
689df530eb3c class: MemoryMonitorView
Claus Gittinger <cg@exept.de>
parents: 10574
diff changeset
  1082