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