MemoryMonitor.st
author Claus Gittinger <cg@exept.de>
Wed, 05 Aug 1998 15:35:34 +0200
changeset 1810 7128a8eb7554
parent 1809 429042db0bb1
child 1875 575272661fc4
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
     1
"
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
     3
	      All Rights Reserved
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
     4
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
     5
 This software is furnished under a license and may be used
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
     6
 only in accordance with the terms of that license and with the
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
     8
 be provided or otherwise made available to, or used by, any
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
     9
 other person.  No title to or ownership of the software is
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
    10
 hereby transferred.
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
    11
"
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
    12
4cde336c0794 Initial revision
claus
parents:
diff changeset
    13
StandardSystemView subclass:#MemoryMonitor
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
    14
	instanceVariableNames:'updateInterval updateBlock myProcess oldData newData freeData
93
claus
parents: 91
diff changeset
    15
		updateIndex org maxTotal minTotal dX newColor freeColor oldColor
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
    16
		prevTotal prevFree prevFree2 prevOld scale drawLock prevMemUsed
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
    17
		prevCodeUsed prevNumWeak prevNumRem prevNumLifoRem prevTenureAge
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
    18
		prevIGCPhase prevLastScavengeReclamation
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
    19
		prevMinScavengeReclamation prevScavengeCount'
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
    20
	classVariableNames:''
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
    21
	poolDictionaries:''
1053
9b1b15ef1e34 category change
Claus Gittinger <cg@exept.de>
parents: 1052
diff changeset
    22
	category:'Monitors-ST/X'
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
    23
!
4cde336c0794 Initial revision
claus
parents:
diff changeset
    24
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
    25
!MemoryMonitor class methodsFor:'documentation'!
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    26
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    27
copyright
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    28
"
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    29
 COPYRIGHT (c) 1991 by Claus Gittinger
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    30
	      All Rights Reserved
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    31
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    32
 This software is furnished under a license and may be used
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    33
 only in accordance with the terms of that license and with the
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    35
 be provided or otherwise made available to, or used by, any
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    36
 other person.  No title to or ownership of the software is
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    37
 hereby transferred.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    38
"
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    39
!
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    40
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    41
documentation
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    42
"
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    43
    Shows memory usage (oldspace + newspace). Simple, but useful.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    44
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    45
    The numbers shown are:
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    46
        tot     total memory usage (i.e. allocated oldSpace + allocated newSpace)
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    47
                (does not include the second semispace and other help-areas,
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    48
                 such as the remembered set etc.)
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    49
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    50
        all     current oldSpace in use + newSpace in use
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    51
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    52
        new     current newSpace in use
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    53
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    54
        frl     free space in (fragmented) free lists
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    55
        fre     compact free area above the used oldSpace
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    56
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    57
        old     current oldSpace in use
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    58
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
    59
        cod     dynamic compiled code space size (just in time compiler)
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
    60
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    61
        max,    extreme values of 'tot' since the monitor started
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    62
        min     (can be reset by typing 'r' in the view)
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    63
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
    64
        t       tenure threshold (1 .. 30)
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    65
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
    66
        I       incremental GC state (2 = idle)
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    67
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    68
        weak    number of weak objects
109
claus
parents: 108
diff changeset
    69
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    70
        rem     size of rememberedSet
108
claus
parents: 107
diff changeset
    71
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    72
        minsc:  percent of newspace remaining after scavenge (worst case)
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    73
                (i.e. the minimum %% of scavenged objects)
108
claus
parents: 107
diff changeset
    74
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    75
        count   number of scavenges since system started
108
claus
parents: 107
diff changeset
    76
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    77
        %       percentage of live objects in newSpace after last scavenge
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    78
                (i.e. this is the garbage vs. living objects ratio of
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    79
                 newSpace objects after the last scavenge)
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    80
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    81
    the graphic shows:
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
    82
        orange  newSpace used
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    83
        green   free memory in freeLists
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    84
        white   oldSpace used
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    85
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    86
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    87
    the popupMenu offers GC functions; keyboard options are:
512
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    88
        'f' -> faster; 's' -> slower; 'r' -> reset min/max
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    89
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    90
    [author:]
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    91
        Claus Gittinger
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    92
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    93
    [see also:]
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    94
        ObjectMemory
b576020aa9be documentation
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
    95
        MemoryUsageMonitor ProcessMonitor
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    96
"
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    97
! !
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    98
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
    99
!MemoryMonitor class methodsFor:'defaults'!
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   100
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   101
defaultExtent
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   102
    ^ (200 @ 320)
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   103
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   104
    "Modified: 24.8.1996 / 12:04:21 / cg"
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   105
!
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   106
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   107
defaultIcon
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   108
    |i|
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   109
93
claus
parents: 91
diff changeset
   110
    i := Image fromFile:'MemMonitor.xbm'.
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   111
    i notNil ifTrue:[^ i].
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   112
    ^ super defaultIcon
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   113
!
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   114
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   115
defaultLabel
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   116
    ^ 'Memory Monitor'
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   117
! !
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   118
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   119
!MemoryMonitor class methodsFor:'startup'!
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   120
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   121
isVisualStartable
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   122
    "returns whether this application class can be started via #open
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   123
     (i.e. via a double click on the class in the browser)"
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   124
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   125
    ^ true
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   126
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   127
    "Created: / 15.7.1998 / 12:59:58 / cg"
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   128
! !
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   129
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   130
!MemoryMonitor methodsFor:'destroying'!
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   131
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   132
destroy
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   133
    updateBlock notNil ifTrue:[
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   134
	Processor removeTimedBlock:updateBlock.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   135
    ] ifFalse:[
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   136
	myProcess terminate.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   137
	myProcess := nil
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   138
    ].
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   139
    oldData := newData := freeData := nil.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   140
    super destroy
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   141
! !
4cde336c0794 Initial revision
claus
parents:
diff changeset
   142
4cde336c0794 Initial revision
claus
parents:
diff changeset
   143
!MemoryMonitor methodsFor:'drawing'!
4cde336c0794 Initial revision
claus
parents:
diff changeset
   144
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   145
displayKilo:aNumber name:nm y:y
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   146
    |s|
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   147
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   148
    s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '.
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   149
    self displayOpaqueString:s x:0 y:y.
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   150
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   151
!
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   152
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   153
redraw
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   154
    "redraw all"
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   155
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   156
    self clear.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   157
    self redrawX:0 y:0 width:width height:height
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   158
!
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   159
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   160
redrawX:x y:y width:w height:h
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   161
    "redraw data"
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   162
107
claus
parents: 105
diff changeset
   163
    |total oldSpaceUsed newSpaceUsed freeMem lx startIdx endIdx
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   164
     right|
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   165
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   166
    shown ifFalse:[^ self].
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   167
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   168
    right := x + w - 1.
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   169
    right >= org ifTrue:[
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   170
        lx := x.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   171
        lx < org ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   172
            lx := org
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   173
        ].
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   174
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   175
        total := ObjectMemory symSpaceSize 
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   176
                 + ObjectMemory oldSpaceSize 
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   177
                 + ObjectMemory newSpaceSize.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   178
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   179
        startIdx := (lx-org+1).
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   180
        startIdx < 1 ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   181
            startIdx := 1
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   182
        ].
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   183
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   184
        endIdx := right-org+1.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   185
        endIdx >= updateIndex ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   186
            endIdx := updateIndex-1.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   187
        ].
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   188
        dX := 0.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   189
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   190
        startIdx to:endIdx do:[:i |
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   191
            newSpaceUsed := newData at:i.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   192
            newSpaceUsed notNil ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   193
                oldSpaceUsed := oldData at:i.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   194
                freeMem := freeData at:i.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   195
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   196
                self updateLineX:lx - dX
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   197
                       total:total 
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   198
                       old:oldSpaceUsed 
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   199
                       new:newSpaceUsed 
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   200
                       free:freeMem.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   201
            ].
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   202
            lx := lx + 1
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   203
        ]
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   204
    ].
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   205
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   206
    x < org ifTrue:[
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   207
        "/ force redraw.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   208
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   209
        prevFree := prevFree2 := prevOld := prevTotal := nil.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   210
        prevMemUsed := prevCodeUsed := prevNumWeak := prevNumRem := nil.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   211
        prevNumLifoRem := prevTenureAge := prevIGCPhase := nil.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   212
        prevLastScavengeReclamation := prevMinScavengeReclamation := nil.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   213
        prevScavengeCount := nil.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   214
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   215
        self updateNumbers.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   216
    ]
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   217
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   218
    "Modified: / 14.7.1998 / 23:33:47 / cg"
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   219
!
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   220
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   221
updateDisplay
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   222
    "update picture; trigger next update"
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   223
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   224
    |total oldSpaceUsed newSpaceUsed freeMem oldSpaceSize
1012
e3793f355ffc new easier bitBlt (default is synchronous)
Claus Gittinger <cg@exept.de>
parents: 994
diff changeset
   225
     gWidth shift scaleChange margin|
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   226
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   227
    shown ifTrue:[
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   228
        drawLock wouldBlock ifFalse:[
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   229
            drawLock critical:[
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   230
                oldSpaceUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   231
                newSpaceUsed := ObjectMemory newSpaceUsed.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   232
                freeMem := ObjectMemory freeListSpace + (ObjectMemory oldSpaceSize - ObjectMemory oldSpaceUsed).
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   233
                oldSpaceSize := ObjectMemory oldSpaceSize + ObjectMemory symSpaceSize.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   234
                total := oldSpaceSize + ObjectMemory newSpaceSize.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   235
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   236
                scaleChange := false.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   237
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   238
                ((total - freeMem) < minTotal) ifTrue:[
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   239
                    minTotal := total - freeMem.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   240
                    scaleChange := true
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   241
                ].
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   242
                (total > maxTotal) ifTrue:[
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   243
                    maxTotal := total.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   244
                    scaleChange := true
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   245
                ].
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   246
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   247
                oldData at:updateIndex put:oldSpaceSize. "/ oldSpaceUsed.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   248
                newData at:updateIndex put:newSpaceUsed.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   249
                freeData at:updateIndex put:freeMem.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   250
                updateIndex := updateIndex + 1.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   251
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   252
                scaleChange ifTrue:[
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   253
                    scale := height asFloat / (maxTotal + 100000).
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   254
                    self redraw
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   255
                ].
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   256
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   257
                gWidth := width - org.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   258
                margin := 1.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   259
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   260
                ((updateIndex-1) >= (gWidth - margin)) ifTrue:[
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   261
        "on slow displays, use:"
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   262
        "/            shift := gWidth // 4.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   263
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   264
        "for smooth display, use:"
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   265
                    shift := 1.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   266
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   267
                    oldData replaceFrom:1 with:oldData startingAt:shift+1.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   268
                    newData replaceFrom:1 with:newData startingAt:shift+1.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   269
                    freeData replaceFrom:1 with:freeData startingAt:shift+1.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   270
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   271
                    updateIndex := updateIndex - shift.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   272
                    dX := dX + shift.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   273
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   274
                    "/ before copying, handle any outstanding exposes ...
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   275
                    self repairDamage.
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   276
                    "/ self catchExpose.
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   277
                    self copyFrom:self 
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   278
                                x:(org + shift) y:0
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   279
                              toX:org y:0
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   280
                            width:(gWidth - shift - margin)
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   281
                           height:height
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   282
                            async:false.
1012
e3793f355ffc new easier bitBlt (default is synchronous)
Claus Gittinger <cg@exept.de>
parents: 994
diff changeset
   283
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   284
                    self clearRectangleX:(width - margin - shift) y:0 
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   285
                                   width:shift height:height.
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   286
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   287
                    "/ self waitForExpose.
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   288
                ].
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   289
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   290
                self updateLineX:(updateIndex - 1 + org - 1)
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   291
                           total:total 
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   292
                           old:oldSpaceSize "/ oldSpaceUsed
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   293
                           new:newSpaceUsed 
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   294
                           free:freeMem.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   295
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   296
                self updateNumbers.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   297
                self flush.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   298
            ].
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   299
        ].
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   300
    ].
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   301
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   302
    updateBlock notNil ifTrue:[
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   303
        Processor addTimedBlock:updateBlock afterSeconds:updateInterval
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   304
    ].
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   305
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   306
    "Modified: / 5.8.1998 / 13:13:18 / cg"
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   307
!
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   308
109
claus
parents: 108
diff changeset
   309
updateLineX:x total:total old:oldSpaceSize new:newSpaceUsed free:freeMem
claus
parents: 108
diff changeset
   310
    |hNew hOld hFree y1 y2 y3|
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   311
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   312
    hNew := (newSpaceUsed * scale) asInteger.
109
claus
parents: 108
diff changeset
   313
    hOld := (oldSpaceSize * scale) // 2.
claus
parents: 108
diff changeset
   314
    hFree := (freeMem * scale) // 2.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   315
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   316
    y1 := height - 1.
109
claus
parents: 108
diff changeset
   317
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   318
    y2 := y1 - hOld.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   319
    self paint:oldColor.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   320
    self displayLineFromX:x y:y1 toX:x y:y2.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   321
109
claus
parents: 108
diff changeset
   322
    y3 := y1 - hFree.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   323
    self paint:freeColor.
109
claus
parents: 108
diff changeset
   324
    self displayLineFromX:x y:y1 toX:x y:y3.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   325
109
claus
parents: 108
diff changeset
   326
    y1 := y2 - hNew.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   327
    self paint:newColor.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   328
    self displayLineFromX:x y:y1 toX:x y:y2.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   329
!
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   330
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   331
updateNumbers
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   332
    "redraw numbers.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   333
     The values shown are:
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   334
        max:    maximum memory used since monitor started
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   335
        min:    minimum memory used since monitor started
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   336
        tot:    total memory used (overall oldSpace + overall newSpace)
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   337
        all:    current memory in use (oldSpace + newSpace)
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   338
        new:    current newSpace in use
735
600fe3dab131 comment
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   339
        fre:    current size of freelist in oldSpace
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   340
        old:    current oldSpace in use
735
600fe3dab131 comment
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   341
        code:   current just-in-time compiled code cache size
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   342
        t:      current tenure age
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   343
        I:      IGC state
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   344
        weak:   number of weak arrays in the system
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   345
        rem     remembered set size
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   346
        lrem    lifo remembered set size
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   347
        minsc:  percent of newspace remaining after scavenge (worst case)
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   348
        irq:    max. interrupt delay
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   349
        count of scavenges / last scavenge survivor rate
156
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   350
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   351
    "
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   352
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   353
    |oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2 
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   354
     codeUsed numWeak numRem numLifoRem tenureAge igcPhase 
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   355
     minScavengeReclamation lastScavengeReclamation scavengeCount
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   356
     y half s fontHeight fontDescent total n|
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   357
91
claus
parents: 85
diff changeset
   358
    oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   359
    newMemUsed := ObjectMemory newSpaceUsed.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   360
    freeMem := ObjectMemory freeListSpace.
91
claus
parents: 85
diff changeset
   361
    oldSpaceSize := ObjectMemory oldSpaceSize + ObjectMemory symSpaceSize.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   362
    newSpaceSize := ObjectMemory newSpaceSize.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   363
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   364
    memUsed := oldMemUsed + newMemUsed "- freeMem".
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   365
    total := oldSpaceSize + newSpaceSize.
68
b70257a99e48 *** empty log message ***
claus
parents: 61
diff changeset
   366
    free2 := ObjectMemory freeSpace.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   367
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   368
    self paint:White on:Black.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   369
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   370
    fontDescent := font descent.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   371
    fontHeight := font height + fontDescent.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   372
    half := height // 2 + fontDescent.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   373
109
claus
parents: 108
diff changeset
   374
    y := half - (fontHeight * 5).
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   375
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   376
    total ~~ prevTotal ifTrue:[
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   377
        ((total - freeMem) < minTotal) ifTrue:[
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   378
            minTotal := total - freeMem.
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   379
        ].
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   380
        (total > maxTotal) ifTrue:[
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   381
            maxTotal := total.
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   382
        ].
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   383
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   384
        self displayKilo:maxTotal name:'max ' y:font ascent.
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   385
        self displayKilo:minTotal name:'min ' y:(height - font descent).
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   386
        self displayKilo:total    name:'tot ' y:y.
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   387
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   388
        prevTotal := total.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   389
    ].
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   390
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   391
    y := y + fontHeight.
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   392
    memUsed ~~ prevMemUsed ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   393
        self displayKilo:memUsed name:'all ' y:y.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   394
        prevMemUsed := memUsed.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   395
    ].
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   396
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   397
    y := y + fontHeight.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   398
    self paint:newColor.
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   399
    self displayKilo:newMemUsed name:'new ' y:y.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   400
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   401
    y := y + fontHeight.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   402
    freeMem ~~ prevFree ifTrue:[
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   403
        self paint:freeColor.
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   404
        self displayKilo:freeMem name:'frl ' y:y.
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   405
        prevFree := freeMem.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   406
    ].
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   407
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   408
    y := y + fontHeight.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   409
    free2 ~~ prevFree2 ifTrue:[
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   410
        self paint:freeColor.
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   411
        self displayKilo:free2 name:'fre ' y:y.
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   412
        prevFree2 := free2.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   413
    ].
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   414
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   415
    y := y + fontHeight.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   416
    (oldMemUsed - freeMem) ~~ prevOld ifTrue:[
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   417
        self paint:oldColor.
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   418
        self displayKilo:(oldMemUsed - freeMem) name:'old ' y:y.
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   419
        prevOld := (oldMemUsed - freeMem).
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   420
    ].
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   421
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   422
    y := y + fontHeight.
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   423
    ObjectMemory supportsJustInTimeCompilation ifTrue:[
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   424
        codeUsed := ObjectMemory compiledCodeSpaceUsed.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   425
        prevCodeUsed ~~ codeUsed ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   426
            self paint:oldColor.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   427
            codeUsed > 9999 ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   428
                s := 'code ' , ((codeUsed // 1024) printStringLeftPaddedTo:4) , 'k'.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   429
            ] ifFalse:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   430
                s := 'code ' , (codeUsed printStringLeftPaddedTo:4) , ' '.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   431
            ].
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   432
            self displayOpaqueString:s x:0 y:y.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   433
            prevCodeUsed := codeUsed.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   434
        ]
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   435
    ].
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   436
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   437
    "
303
1d94813f1977 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 168
diff changeset
   438
     the following is internal - normally only interesting when debugging the VM
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   439
    "
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   440
    y := y + fontHeight.
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   441
    tenureAge := ObjectMemory tenureAge.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   442
    igcPhase := ObjectMemory incrementalGCPhase.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   443
    (prevTenureAge ~~ tenureAge
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   444
    or:[prevIGCPhase ~~ igcPhase]) ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   445
        self paint:oldColor.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   446
        s := 't:' , (tenureAge printStringLeftPaddedTo:2) , ' '.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   447
        s := s , ' I:' , (igcPhase printStringLeftPaddedTo:2) , ' '.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   448
        self displayOpaqueString:s x:0 y:y.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   449
        prevTenureAge := tenureAge.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   450
        prevIGCPhase := igcPhase.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   451
    ].
108
claus
parents: 107
diff changeset
   452
claus
parents: 107
diff changeset
   453
    y := y + fontHeight.
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   454
    numWeak := ObjectMemory numberOfWeakObjects.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   455
    prevNumWeak ~~ numWeak ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   456
        self paint:oldColor.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   457
        s := 'weak: ' , (numWeak printStringLeftPaddedTo:4).
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   458
        self displayOpaqueString:s x:0 y:y.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   459
        prevNumWeak := numWeak.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   460
    ].
109
claus
parents: 108
diff changeset
   461
claus
parents: 108
diff changeset
   462
    y := y + fontHeight.
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   463
    numRem := ObjectMemory rememberedSetSize.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   464
    prevNumRem ~~ numRem ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   465
        self paint:oldColor.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   466
        s := 'rem: ' , (numRem printStringLeftPaddedTo:5).
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   467
        self displayOpaqueString:s x:0 y:y.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   468
        prevNumRem := numRem.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   469
    ].
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   470
109
claus
parents: 108
diff changeset
   471
    y := y + fontHeight.
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   472
    numLifoRem := ObjectMemory lifoRememberedSetSize.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   473
    prevNumLifoRem ~~ numLifoRem ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   474
        self paint:oldColor.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   475
        s := 'lrem: ' , (numLifoRem printStringLeftPaddedTo:4 ifLarger:['****']).
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   476
        self displayOpaqueString:s x:0 y:y.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   477
        prevNumLifoRem := numLifoRem.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   478
    ].
109
claus
parents: 108
diff changeset
   479
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   480
"/ does no longer make sense to show ....
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   481
"/    y := y + fontHeight.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   482
"/    ObjectMemory runsSingleOldSpace ifTrue:[
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   483
"/        self displayOpaqueString:'single' x:0 y:(half + (fontHeight*4)).
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   484
"/    ].
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   485
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   486
    y := y + fontHeight.
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   487
    minScavengeReclamation := ObjectMemory minScavengeReclamation * 100 // ObjectMemory newSpaceSize.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   488
    prevMinScavengeReclamation ~~ minScavengeReclamation ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   489
        minScavengeReclamation := 100 - minScavengeReclamation asInteger.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   490
        s := 'minSc ', (minScavengeReclamation printStringLeftPaddedTo:3) , '%'.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   491
        self paint:oldColor.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   492
        self displayOpaqueString:s x:0 y:y.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   493
        prevMinScavengeReclamation := minScavengeReclamation.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   494
    ].
108
claus
parents: 107
diff changeset
   495
claus
parents: 107
diff changeset
   496
    y := y + fontHeight.
157
77f56399cc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   497
    n := ObjectMemory maxInterruptLatency.
156
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   498
    n notNil ifTrue:[
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   499
        s := 'irq ', (n printStringLeftPaddedTo:3) , ' ms'.
156
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   500
    ] ifFalse:[
696
b55f8705bb41 show memory use of dynamic code cache
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
   501
        s := ''
156
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   502
    ].
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   503
    self displayOpaqueString:s x:0 y:y.
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   504
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   505
    y := y + fontHeight.
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   506
    scavengeCount := ObjectMemory scavengeCount.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   507
    lastScavengeReclamation := ObjectMemory lastScavengeReclamation * 100 // ObjectMemory newSpaceSize.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   508
    (prevScavengeCount ~~ scavengeCount
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   509
    or:[prevLastScavengeReclamation ~~ lastScavengeReclamation]) ifTrue:[
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   510
        lastScavengeReclamation := 100 - lastScavengeReclamation asInteger.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   511
        s := (scavengeCount printStringLeftPaddedTo:6)
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   512
             , (lastScavengeReclamation printStringLeftPaddedTo:3) , '%'.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   513
        self displayOpaqueString:s x:0 y:y.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   514
        prevLastScavengeReclamation := lastScavengeReclamation.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   515
        prevScavengeCount := scavengeCount.
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   516
    ].
156
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   517
1721
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   518
    "Created: / 7.11.1995 / 14:48:16 / cg"
4d19c61fa688 avoid generating garbage when updating the display
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
   519
    "Modified: / 14.7.1998 / 23:35:53 / cg"
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   520
! !
4cde336c0794 Initial revision
claus
parents:
diff changeset
   521
4cde336c0794 Initial revision
claus
parents:
diff changeset
   522
!MemoryMonitor methodsFor:'events'!
4cde336c0794 Initial revision
claus
parents:
diff changeset
   523
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   524
keyPress:key x:x y:y
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   525
    key == $f ifTrue:[
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   526
	"faster"
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   527
	updateInterval := updateInterval / 2
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   528
    ].
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   529
    key == $s ifTrue:[
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   530
	"slower"
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   531
	updateInterval := updateInterval * 2
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   532
    ].
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   533
    key == $r ifTrue:[
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   534
	"reset max"
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   535
	maxTotal := prevTotal.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   536
	scale := height asFloat / (maxTotal + 100000).
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   537
	self resetStatisticValues.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   538
	self redraw.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   539
    ]
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   540
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   541
    "Modified: 7.11.1995 / 17:45:13 / cg"
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   542
!
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   543
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   544
sizeChanged:how
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   545
    |nn no nf delta oldSize newSize|
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   546
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   547
    super sizeChanged:how.
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   548
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   549
    oldSize := oldData size.
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   550
    newSize := width-org+1.
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
   551
168
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   552
    (newSize ~~ oldSize) ifTrue:[
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   553
	nn := Array new:newSize.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   554
	no := Array new:newSize.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   555
	nf := Array new:newSize.
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   556
168
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   557
	(newSize > oldSize) ifTrue:[
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   558
	    nn replaceFrom:1 to:oldSize with:newData.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   559
	    no replaceFrom:1 to:oldSize with:oldData.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   560
	    nf replaceFrom:1 to:oldSize with:freeData
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   561
	] ifFalse:[
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   562
	    delta := (oldSize - newSize).
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   563
	    nn replaceFrom:1 with:newData startingAt:delta+1.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   564
	    no replaceFrom:1 with:oldData startingAt:delta+1.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   565
	    nf replaceFrom:1 with:freeData startingAt:delta+1.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   566
	    updateIndex > newSize ifTrue:[
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   567
		updateIndex := updateIndex - delta.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   568
	    ]
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   569
	].
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   570
	newData := nn.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   571
	oldData := no.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   572
	freeData := nf.
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   573
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   574
	scale := height asFloat / (maxTotal + 100000).
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   575
    ].
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   576
    self clear.
168
0ca5ca046b22 Redraw text on vertical window size changes.
Stefan Vogel <sv@exept.de>
parents: 165
diff changeset
   577
    self redraw.
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   578
! !
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   579
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   580
!MemoryMonitor methodsFor:'initialization'!
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   581
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   582
initialize
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   583
    super initialize.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   584
994
1734123c7520 friendly semaphore names
Claus Gittinger <cg@exept.de>
parents: 989
diff changeset
   585
    drawLock := Semaphore forMutualExclusion name:'drawLock'.
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   586
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   587
    updateInterval := 0.5.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   588
    ProcessorScheduler isPureEventDriven ifTrue:[
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   589
        updateBlock := [self updateDisplay].
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   590
    ].
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   591
    oldData := Array new:1000.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   592
    newData := Array new:1000.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   593
    freeData := Array new:1000.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   594
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   595
    updateIndex := 1.
1756
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   596
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   597
    self font:((Font family:'courier' face:'medium' style:'roman' size:10) onDevice:device).
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   598
    org := font widthOf:'max 99999k '.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   599
    level := 0.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   600
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   601
    maxTotal := minTotal := ObjectMemory oldSpaceSize 
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   602
                            + ObjectMemory symSpaceSize
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   603
                            + ObjectMemory newSpaceSize.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   604
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   605
    viewBackground := Black.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   606
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   607
    device hasColors ifTrue:[
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   608
        newColor := Color orange. "/ yellow.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   609
        freeColor := Color green.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   610
        oldColor := Color white.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   611
    ] ifFalse:[
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   612
        newColor := Color grey:67.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   613
        freeColor := Color grey:33.
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   614
        oldColor := Color white.
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   615
    ].
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   616
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   617
    self model:self.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   618
    self menu:#memoryMenu
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   619
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   620
    "
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   621
     MemoryMonitor open
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   622
    "
989
0f047353b974 need a lock while drawing
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
   623
1756
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   624
    "Modified: / 27.7.1998 / 19:57:07 / cg"
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   625
!
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   626
85
d9713a3ca092 *** empty log message ***
claus
parents: 79
diff changeset
   627
memoryMenu
1795
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   628
    <resource: #programMenu>
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   629
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   630
    |m items moreItems specialMenu|
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   631
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   632
    items := #(
1809
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   633
                    ('background collect now'       backgroundCollect)
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   634
                    ('hi prio incremental collect'  incrementalCollect)
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   635
                    ('-')
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   636
                    ('scavenge'                     scavenge)
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   637
                    ('tenure'                       tenure)
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   638
                    ('-')
1809
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   639
                    ('cleanup memory'               cleanupMemory)
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   640
                    ('flush method history'         cleanupMethodHistory)
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   641
                    ('unload autoloaded classes'    unloadAllAutoloadedClasses)
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   642
                    ('-')
1809
429042db0bb1 reorganized menu again
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
   643
                    ('compress sources'             compressSources)
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   644
              ).
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   645
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   646
    ObjectMemory backgroundCollectorRunning ifFalse:[
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   647
        moreItems := #(
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   648
                    ('start background collector'   restartBackgroundCollector )
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   649
                 ) 
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   650
    ] ifTrue:[
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   651
        (ObjectMemory backgroundCollectProcess priorityRange notNil)
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   652
        ifTrue:[
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   653
            moreItems := #(
1810
7128a8eb7554 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   654
                    ('stop background collector'             stopBackgroundCollector      )
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   655
                    ('background collect with fix priority'  backgroundCollectWithFixPrio )
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   656
                     ) 
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   657
        ] ifFalse:[
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   658
            moreItems := #(
1810
7128a8eb7554 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   659
                    ('stop background collector'                stopBackgroundCollector      )
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   660
                    ('background collect with dynamic priority' backgroundCollectWithDynamicPrio )
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   661
                     ) 
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   662
        ].
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   663
    ].
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   664
    items := moreItems , items.
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   665
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   666
    specialMenu := PopUpMenu
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   667
                        itemList:items
1619
6e4b1930841a use new itemList message from PopUpMenu
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
   668
                        resources:resources.
85
d9713a3ca092 *** empty log message ***
claus
parents: 79
diff changeset
   669
105
claus
parents: 93
diff changeset
   670
    device ctrlDown ifTrue:[
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   671
        ^ specialMenu
105
claus
parents: 93
diff changeset
   672
    ].
85
d9713a3ca092 *** empty log message ***
claus
parents: 79
diff changeset
   673
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   674
    items :=    #(
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   675
                    ('collect garbage'              garbageCollect                  )
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   676
                    ('collect garbage & symbols'    garbageCollectAndSymbols        )
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   677
                    ('collect garbage & compress'   compressingGarbageCollect       )
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   678
                    ('-')                                                           
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   679
                    ('reset statistic values'       resetStatisticValues            )
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   680
                    ('-')
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   681
                    ('others'                       otherMenu                       Ctrl)
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   682
                  ).
1206
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   683
1619
6e4b1930841a use new itemList message from PopUpMenu
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
   684
    m := PopUpMenu itemList:items resources:resources.
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   685
    m subMenuAt:#otherMenu put:specialMenu.
1795
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   686
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   687
    ^ m
972
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   688
1810
7128a8eb7554 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   689
    "Modified: / 5.8.1998 / 15:35:14 / cg"
85
d9713a3ca092 *** empty log message ***
claus
parents: 79
diff changeset
   690
!
d9713a3ca092 *** empty log message ***
claus
parents: 79
diff changeset
   691
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   692
realize
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   693
    super realize.
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   694
    updateBlock notNil ifTrue:[
1756
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   695
        Processor addTimedBlock:updateBlock afterSeconds:updateInterval.
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   696
    ] ifFalse:[
1756
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   697
        myProcess := [
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   698
            |d|
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   699
1756
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   700
            [true] whileTrue:[
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   701
                (Delay forSeconds:updateInterval) wait.
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   702
                self updateDisplay
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   703
            ]
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   704
        ] forkAt:6.
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   705
        myProcess name:'monitor [' , 
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   706
                       Processor activeProcess id printString ,
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   707
                       '] update'
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   708
    ].
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   709
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   710
    newColor := newColor on:device.
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   711
    freeColor := freeColor on:device.
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   712
    oldColor := oldColor on:device.
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   713
1756
3cf323b3b704 must change the font first, then ask for its width.
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
   714
    "Modified: / 27.7.1998 / 19:57:51 / cg"
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   715
! !
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   716
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   717
!MemoryMonitor methodsFor:'menu functions'!
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   718
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   719
backgroundCollect
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   720
    "start a background (non disturbing) incremental GC. 
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   721
     Since the GC is performed at a low priority, it may not make progress if higher
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   722
     prio processes are running"
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   723
 
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   724
    [
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   725
	ObjectMemory incrementalGC
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   726
    ] forkAt:5 
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   727
!
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   728
1795
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   729
backgroundCollectWithDynamicPrio
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   730
    "setup the background collector to run at dynamic priority.
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   731
     This is a new experimental feature."
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   732
1796
32c7e361cce6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
   733
    Processor isTimeSlicing ifFalse:[
32c7e361cce6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
   734
        Processor startTimeSlicing.
32c7e361cce6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
   735
        Processor supportDynamicPriorities:true
32c7e361cce6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
   736
    ].
32c7e361cce6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
   737
1795
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   738
    ObjectMemory backgroundCollectProcess priorityRange:(5 to:9).
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   739
    ObjectMemory backgroundFinalizationProcess priorityRange:(5 to:9).
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   740
1796
32c7e361cce6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
   741
    "Modified: / 4.8.1998 / 02:16:02 / cg"
1795
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   742
!
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   743
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   744
backgroundCollectWithFixPrio
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   745
    "setup the background collector to run at a fix priority.
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   746
     This is the default."
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   747
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   748
    ObjectMemory backgroundCollectProcess priorityRange:nil.
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   749
    ObjectMemory backgroundFinalizationProcess priorityRange:nil.
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   750
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   751
    "Modified: / 4.8.1998 / 02:00:31 / cg"
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   752
!
8a1731490268 more menu functions for configuring the
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
   753
105
claus
parents: 93
diff changeset
   754
cleanupMemory
claus
parents: 93
diff changeset
   755
    "let all classes release unneeded, cached
claus
parents: 93
diff changeset
   756
     data ..."
claus
parents: 93
diff changeset
   757
469
3653317928e2 dont repeat coding in ObjectMemory ...
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   758
    ObjectMemory performLowSpaceCleanup.
3653317928e2 dont repeat coding in ObjectMemory ...
Claus Gittinger <cg@exept.de>
parents: 360
diff changeset
   759
105
claus
parents: 93
diff changeset
   760
    "
claus
parents: 93
diff changeset
   761
     then, perform a GC (incl. symbol reclamation)
claus
parents: 93
diff changeset
   762
    "
claus
parents: 93
diff changeset
   763
    ObjectMemory reclaimSymbols.
claus
parents: 93
diff changeset
   764
    "
claus
parents: 93
diff changeset
   765
     finally, compress
claus
parents: 93
diff changeset
   766
    "
1205
0b60eda64a3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   767
    ObjectMemory tenure.
105
claus
parents: 93
diff changeset
   768
    ObjectMemory verboseGarbageCollect.
1205
0b60eda64a3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   769
0b60eda64a3b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   770
    "Modified: 26.6.1997 / 17:12:53 / cg"
105
claus
parents: 93
diff changeset
   771
!
claus
parents: 93
diff changeset
   772
844
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   773
cleanupMethodHistory
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   774
    "release the oldMethod history"
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   775
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   776
    (self confirm:'This removes the previous method history,
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   777
which is kept for all changed methods in the system.
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   778
After that, the browsers cannot easily switch back to a methods
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   779
previous version.
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   780
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   781
However, this is normally not a problem, since
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   782
a methods previous code should still be accessable through
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   783
either the changes-file, the sourceCode repository or the classes original
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   784
source file.
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   785
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   786
cleanup now ?') ifTrue:[
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   787
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   788
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   789
        Class flushMethodHistory.
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   790
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   791
        "
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   792
         then, perform a GC (incl. symbol reclamation)
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   793
        "
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   794
        ObjectMemory reclaimSymbols.
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   795
        "
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   796
         finally, compress
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   797
        "
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   798
        ObjectMemory verboseGarbageCollect.
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   799
   ]
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   800
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   801
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   802
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   803
!
95fde6837db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
   804
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   805
compressSources
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   806
    (self confirm:'This saves all in-memory source strings into a file
360
5347e1bfae74 box text in compressSources
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   807
and makes methods reference these (file-) strings,
5347e1bfae74 box text in compressSources
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   808
freeing all in-memory sources.
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   809
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   810
If that source file is ever lost or gets out of sync with
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   811
your system, those method sources are lost and the browser
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   812
will show garbage. 
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   813
However, you still have a change file as backup.
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   814
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   815
(Be especially careful, if you move images around:
360
5347e1bfae74 box text in compressSources
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   816
 the source file must then be the correct one for that image)
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   817
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   818
A compress is only useful, if you added many methods
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   819
and the systems response time suffers from paging.
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   820
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   821
Compress anyway ?') ifTrue:[
350
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   822
        windowGroup withWaitCursorDo:[
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   823
            Smalltalk compressSources.
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   824
            ObjectMemory markAndSweep
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   825
        ]
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   826
    ]
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   827
360
5347e1bfae74 box text in compressSources
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
   828
    "Modified: 9.2.1996 / 18:17:22 / cg"
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   829
!
156
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   830
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   831
compressingGarbageCollect
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   832
    "perform a blocking compressing garbage collect."
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   833
350
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   834
    windowGroup withWaitCursorDo:[
1261
f59a1039ae3c tenure in GC to break rememberedSet refs.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
   835
        ObjectMemory tenure.
350
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   836
        ObjectMemory verboseGarbageCollect
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   837
    ]
1261
f59a1039ae3c tenure in GC to break rememberedSet refs.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
   838
f59a1039ae3c tenure in GC to break rememberedSet refs.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
   839
    "Modified: 30.7.1997 / 21:19:47 / cg"
156
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   840
!
e6a7f80e2a71 show irq latency
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
   841
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   842
garbageCollect
159
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   843
    "perform a blocking (non compressing) garbage collect"
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   844
350
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   845
    windowGroup withWaitCursorDo:[
1261
f59a1039ae3c tenure in GC to break rememberedSet refs.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
   846
        ObjectMemory tenure.
350
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   847
        ObjectMemory markAndSweep
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   848
    ]
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   849
1261
f59a1039ae3c tenure in GC to break rememberedSet refs.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
   850
    "Modified: 30.7.1997 / 21:19:35 / cg"
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   851
!
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   852
105
claus
parents: 93
diff changeset
   853
garbageCollectAndSymbols
159
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   854
    "perform a blocking (non compressing) garbage collect
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   855
     and reclaim unreferenced symbols."
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   856
350
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   857
    windowGroup withWaitCursorDo:[
1261
f59a1039ae3c tenure in GC to break rememberedSet refs.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
   858
        ObjectMemory tenure.
350
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   859
        ObjectMemory reclaimSymbols
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   860
    ]
68c5fed6c9bc show waitCursor while collecting
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   861
1261
f59a1039ae3c tenure in GC to break rememberedSet refs.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
   862
    "Modified: 30.7.1997 / 21:19:41 / cg"
105
claus
parents: 93
diff changeset
   863
!
claus
parents: 93
diff changeset
   864
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   865
incrementalCollect
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   866
    "start an incremental GC which does not disturb too much, but is guaranteed to
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   867
     make progress.
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   868
     This is done by doing the IGC at a very high priority, but giving up the CPU after
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   869
     every step. Due to the long delays, this may take a while to finish.
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   870
     Notice, that this is different from doing a background collect: that one
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   871
     may not make any progress if higher prio processes are runnable."
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   872
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   873
    |done delay|
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   874
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   875
    [
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   876
        done := false.
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   877
        delay := Delay new.
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   878
        [done] whileFalse:[
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   879
            10 timesRepeat:[
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   880
                done ifFalse:[done := ObjectMemory gcStep].
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   881
            ].
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   882
            (delay delay:10) wait
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   883
        ]
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   884
    ] forkAt:Processor highestPriority
323
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   885
f443d7e5bab0 special menu published
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
   886
    "Modified: 23.12.1995 / 17:31:55 / cg"
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   887
!
159
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   888
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   889
resetStatisticValues 
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   890
    ObjectMemory resetMaxInterruptLatency.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   891
    ObjectMemory resetMinScavengeReclamation.
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   892
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   893
    "Created: 7.11.1995 / 17:44:59 / cg"
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   894
!
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   895
972
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   896
restartBackgroundCollector
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   897
    "(re)start a background (non disturbing) incremental GC. 
972
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   898
     Since the GC is performed at a low priority, it may not make progress if higher
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   899
     prio processes are running"
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   900
 
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   901
    ObjectMemory backgroundCollectorRunning
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   902
    ifFalse:[
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   903
        ObjectMemory startBackgroundCollectorAt:5.
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   904
        ObjectMemory startBackgroundFinalizationAt:5
972
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   905
    ]
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   906
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   907
    "Created: / 21.1.1997 / 00:09:30 / cg"
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   908
    "Modified: / 5.8.1998 / 14:30:17 / cg"
972
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   909
!
7f8884cb99e2 items renamed;
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   910
105
claus
parents: 93
diff changeset
   911
scavenge 
159
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   912
    "perform a blocking newspace garbage collect.
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   913
     (this is for debugging only - the system does this automatically)"
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   914
105
claus
parents: 93
diff changeset
   915
    ObjectMemory scavenge
claus
parents: 93
diff changeset
   916
!
claus
parents: 93
diff changeset
   917
1808
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   918
stopBackgroundCollector
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   919
    "stop the background (non disturbing) incremental GC. 
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   920
     We do not recommend this - but maybe useful for debugging and
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   921
     evaluating the programs behavior in heavy-load situations
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   922
     (background collector cannot keep up with the allocation rate)"
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   923
 
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   924
    ObjectMemory stopBackgroundCollector.
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   925
    ObjectMemory stopBackgroundFinalization
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   926
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   927
    "Created: / 5.8.1998 / 14:29:40 / cg"
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   928
!
a1aa484160ee reorganized menu (place less often used items in special menu);
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   929
105
claus
parents: 93
diff changeset
   930
tenure 
159
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   931
    "empty the newSpace, by aging all new objects immediately and transfering them
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   932
     into oldSpace.
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   933
     (this is for debugging only - the system does this automatically)"
159f86b6395a comments added
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   934
105
claus
parents: 93
diff changeset
   935
    ObjectMemory tenure
1206
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   936
!
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   937
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   938
unloadAllAutoloadedClasses
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   939
    "unload all classes which were autoloaded and have no instances"
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   940
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   941
    Autoload loadedClasses copy do:[:anAutoloadedClass |
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   942
        anAutoloadedClass hasInstances ifFalse:[
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   943
            anAutoloadedClass unload
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   944
        ]
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   945
    ].
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   946
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   947
    "Created: 27.6.1997 / 14:21:45 / cg"
e3894601c394 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   948
    "Modified: 27.6.1997 / 14:22:47 / cg"
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   949
! !
105
claus
parents: 93
diff changeset
   950
798
5ef299968209 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   951
!MemoryMonitor class methodsFor:'documentation'!
85
d9713a3ca092 *** empty log message ***
claus
parents: 79
diff changeset
   952
311
c118ce1f8afd flush in subprocess
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
   953
version
1810
7128a8eb7554 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   954
    ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.56 1998-08-05 13:35:34 cg Exp $'
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
   955
! !