ProcessMonitor.st
author Claus Gittinger <cg@exept.de>
Sun, 02 Mar 1997 11:23:46 +0100
changeset 1053 9b1b15ef1e34
parent 1052 81d87e3e1d14
child 1103 c70ece0e331a
permissions -rw-r--r--
category change
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     1
"
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     3
	      All Rights Reserved
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     4
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     5
 This software is furnished under a license and may be used
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     6
 only in accordance with the terms of that license and with the
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
     9
 other person.  No title to or ownership of the software is
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    10
 hereby transferred.
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    11
"
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    12
982
ed5de0e2fb24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 979
diff changeset
    13
SystemStatusMonitor subclass:#ProcessMonitor
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    14
	instanceVariableNames:'processes hideDead runColor suspendedColor waitColor cpuUsages
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    15
		showDetail'
315
8a86faf847d1 create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
    16
	classVariableNames:''
8a86faf847d1 create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
    17
	poolDictionaries:''
1053
9b1b15ef1e34 category change
Claus Gittinger <cg@exept.de>
parents: 1052
diff changeset
    18
	category:'Monitors-ST/X'
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
    19
!
4cde336c0794 Initial revision
claus
parents:
diff changeset
    20
771
5cd10b4845f3 oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
    21
!ProcessMonitor class methodsFor:'documentation'!
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    22
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    23
copyright
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    24
"
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    25
 COPYRIGHT (c) 1993 by Claus Gittinger
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    26
	      All Rights Reserved
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    27
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    28
 This software is furnished under a license and may be used
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    29
 only in accordance with the terms of that license and with the
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    31
 be provided or otherwise made available to, or used by, any
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    32
 other person.  No title to or ownership of the software is
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    33
 hereby transferred.
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    34
"
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    35
!
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    36
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    37
documentation
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    38
"
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    39
    This view shows smalltalks (light-weight) processes, and also offers
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    40
    a popup menu for various useful operations on them.
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    41
    Especially 'debug' is useful, to see what a process is currently
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    42
    doing.
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
    43
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    44
    The information shown is:
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    45
        id         - the numeric id of the process
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    46
        name       - the name (if any) of the process
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    47
                     (the name has no semantic meaning; it exists for the processMonitor only)
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    48
        state      - what is it doing;
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    49
                        wait      - waiting on a semaphore
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    50
                        eventWait - waiting on a view-event semaphore
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    51
                        ioWait    - waiting on an io-semaphore
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    52
                        timeWait  - waiting for a time-semaphore
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    53
                        run       - run, but currently not scheduled
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    54
                        active    - really running (this info is useless, since at
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    55
                                    update time, its always the update process which is
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    56
                                    running)
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    57
                        suspended - suspended; not waiting on a semaphore
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    58
                        light     - not yet started (i.e. has no stack yet)
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    59
        
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    60
        prio       - the processes priority (1..30)
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    61
        usedStack  - the current stack use
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    62
        totalStack - the stack currently allocated (i.e. the maximum ever needed)
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    63
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    64
    [see also:]
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    65
        Process ProcessorScheduler
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    66
        WindowGroup
983
e02eaa70dbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 982
diff changeset
    67
        SemaphoreMonitor
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    68
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    69
    [author:]
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    70
        Claus Gittinger
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    71
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    72
    [start with:]
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    73
        ProcessMonitor open
52
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    74
"
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    75
! !
7b48409ae088 *** empty log message ***
claus
parents: 49
diff changeset
    76
771
5cd10b4845f3 oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
    77
!ProcessMonitor class methodsFor:'defaults'!
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
    78
56
d0cb937cbcaa *** empty log message ***
claus
parents: 52
diff changeset
    79
defaultIcon
d0cb937cbcaa *** empty log message ***
claus
parents: 52
diff changeset
    80
    |i|
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
    81
93
claus
parents: 92
diff changeset
    82
    i := Image fromFile:'ProcMon.xbm'.
56
d0cb937cbcaa *** empty log message ***
claus
parents: 52
diff changeset
    83
    i notNil ifTrue:[^ i].
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    84
    ^ super defaultIcon
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    85
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
    86
    "Modified: 23.1.1997 / 02:52:31 / cg"
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
    87
!
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
    88
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
    89
defaultLabel
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
    90
    ^ 'Process Monitor'
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
    91
! !
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
    92
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
    93
!ProcessMonitor methodsFor:'drawing'!
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
    94
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
    95
titleLine
109
claus
parents: 107
diff changeset
    96
    showDetail ifTrue:[
682
e51a6364c34f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    97
    ^ 'id  group  name                           state    prio usedStack    totalStack  current-segment      switch  where'.
109
claus
parents: 107
diff changeset
    98
    ].
663
befe6a1d886f show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
    99
    ^ 'id  group name                           state    prio usedStack  where'.
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   100
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   101
    "Modified: 3.7.1996 / 13:57:38 / stefan"
682
e51a6364c34f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
   102
    "Modified: 24.7.1996 / 17:21:15 / cg"
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   103
!
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   104
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   105
updateList
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   106
    "update list of processes"
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   107
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   108
    |newList|
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   109
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   110
    shown ifTrue:[
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   111
        showDetail ifTrue:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   112
            newList := Process allInstances asOrderedCollection.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   113
        ] ifFalse:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   114
            newList := ProcessorScheduler knownProcesses asOrderedCollection.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   115
        ].
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   116
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   117
        "sort by id - take care of nil ids of dead processes"
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   118
        newList sort:[:p1 :p2 |
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   119
                         |id1 id2|
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   120
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   121
                         (p1 isNil or:[(id1 := p1 id) isNil])
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   122
                             ifTrue:[true]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   123
                             ifFalse:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   124
                                 (p2 isNil or:[(id2 := p2 id) isNil])
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   125
                                     ifTrue:[false]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   126
                                     ifFalse:[id1 < id2]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   127
                         ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   128
                     ].
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   129
        newList ~= processes ifTrue:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   130
            processes := WeakArray withAll:newList.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   131
            self updateStatus
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   132
        ].
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   133
    ].
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   134
    updateBlock notNil ifTrue:[
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   135
        Processor removeTimedBlock:listUpdateBlock.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   136
        Processor addTimedBlock:listUpdateBlock afterSeconds:listUpdateDelay
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   137
    ].
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   138
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   139
    "Modified: 3.7.1996 / 13:37:29 / stefan"
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   140
!
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   141
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   142
updateStatus
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   143
    "update status display of processes"
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   144
1009
389ee01be263 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   145
    |oldList list line dIndex interrupted contextCount 
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   146
     aProcess nm st n found running sel space|
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   147
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   148
    space := Character space.
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   149
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   150
    shown ifTrue:[
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   151
        oldList := listView list.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   152
        processes notNil ifTrue:[
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   153
            list := OrderedCollection new:(processes size + 2).
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   154
            list add:self titleLine.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   155
            list add:(String new:self titleLine size withAll:$-).
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   156
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   157
            interrupted := Processor interruptedProcess.
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   158
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   159
            dIndex := 1.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   160
            1 to:processes size do:[:index |
680
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   161
                |con c totalStack sender id gId|
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   162
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   163
                aProcess := processes at:index.
775
f741dc4afe19 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
   164
                (aProcess notNil 
1007
cf9bad620e24 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   165
                and:[aProcess ~~ 0]) ifTrue:[
680
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   166
                    ((id := aProcess id) notNil or:[hideDead not]) ifTrue:[
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   167
                        line := WriteStream on:(String new:200).
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   168
680
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   169
                        id printOn:line paddedTo:5.
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   170
                        gId := aProcess processGroupId.
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   171
                        gId == id ifTrue:[
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   172
                            "/ a group leader
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   173
                            '-    ' printOn:line.
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   174
                        ] ifFalse:[
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   175
                            gId printOn:line paddedTo:5.
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   176
                        ].
663
befe6a1d886f show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   177
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   178
                        (nm := aProcess name) isNil ifFalse:[
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   179
                            nm := nm printStringPaddedTo:28.
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   180
                            nm size >= 29 ifTrue:[
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   181
                                nm := (nm contractTo:28).
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   182
                            ].
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   183
                            line nextPutAll:nm; nextPut:space.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   184
                        ] ifTrue:[
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   185
                            line next:29 put:space.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   186
                        ].
680
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   187
"/                        n := cpuUsages at:(id) ifAbsent:[0].
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   188
"/                        n ~~ 0 ifTrue:[
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   189
"/                            line := line , ((n * 4) printStringLeftPaddedTo:3)
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   190
"/                        ] ifFalse:[
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   191
"/                            line := line , '   '
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   192
"/                        ].
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   193
                        st := aProcess state.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   194
                        (st == #run
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   195
                         and:[aProcess == interrupted]) ifTrue:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   196
                            c := ' *'.
322
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   197
                            running := true.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   198
                        ] ifFalse:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   199
                            c := '  '.
322
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   200
                            running := false.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   201
                        ].
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   202
                        line nextPutAll:c; nextPutAll:(st printStringPaddedTo:9).
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   203
                        line nextPutAll:(aProcess priority printStringLeftPaddedTo:3).
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   204
                        line nextPutAll:(aProcess usedStackSize printStringLeftPaddedTo:11).
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   205
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   206
                        con := aProcess suspendedContext.
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   207
                        con isNil ifTrue:[
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   208
                            aProcess == Processor activeProcess ifTrue:[
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   209
                                con := thisContext
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   210
                            ]
322
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   211
                        ].
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   212
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   213
                        showDetail ifTrue:[
680
c17630142bab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   214
                            id == 0 ifTrue:[
1007
cf9bad620e24 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   215
                                line nextPutAll:('unlimited' leftPaddedTo:14).
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   216
                            ] ifFalse:[
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   217
                                n := aProcess numberOfStackSegments.
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   218
                                line nextPutAll:(aProcess totalStackSize printStringLeftPaddedTo:10).
1007
cf9bad620e24 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   219
                                line nextPutAll:(('(' , n printString , ')') paddedTo:4).
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   220
                            ].
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   221
                            con notNil ifTrue:[
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   222
                                line nextPutAll:'    '.
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   223
                                line nextPutAll:(((ObjectMemory addressOf:con) printStringRadix:16) leftPaddedTo:8 with:$0).
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   224
                                line nextPutAll:' .. '.
1009
389ee01be263 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   225
389ee01be263 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   226
                                contextCount := 1.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   227
                                c := con.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   228
                                [(sender := c sender) notNil] whileTrue:[
1009
389ee01be263 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   229
                                    c := sender.
389ee01be263 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   230
                                    contextCount := contextCount + 1.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   231
                                ].
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   232
                                line nextPutAll:(((ObjectMemory addressOf:c) printStringRadix:16) leftPaddedTo:8 with:$0).
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   233
                            ] ifFalse:[
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   234
                                line next:20 put:space.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   235
                            ].
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   236
                            line nextPut:space.
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   237
                            line nextPutAll:(aProcess numberOfStackBoundaryHits printStringLeftPaddedTo:6).
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   238
                        ].
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   239
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   240
                        con notNil ifTrue:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   241
                            c := con.
413
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   242
                            found := false.
322
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   243
                            running ifFalse:[
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   244
                                "/ search for a semaphore-wait in the top 10 contexts
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   245
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   246
                                1 to:10 do:[:n |
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   247
                                    found ifFalse:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   248
                                        c notNil ifTrue:[
409
86125c414826 dont send #isMemberOf: to the receiver (could be nil-subclass)
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   249
                                            (c receiver class == Semaphore) ifTrue:[
322
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   250
                                                c selector == #wait ifTrue:[
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   251
                                                    found := true.
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   252
                                                ]
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   253
                                            ].
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   254
                                            c := c sender.
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   255
                                        ]
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   256
                                    ]
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   257
                                ].
413
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   258
                            ].    
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   259
                            found ifFalse:[
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   260
                                "/ search for a non-processor receiver in the top 10 contexts
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   261
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   262
                                c := con.
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   263
                                1 to:10 do:[:n |
428
1c7406f57591 skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   264
                                    |r|
1c7406f57591 skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   265
413
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   266
                                    found ifFalse:[
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   267
                                        c notNil ifTrue:[
428
1c7406f57591 skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   268
                                            ((r := c receiver) ~~ Processor 
1c7406f57591 skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   269
                                             and:[r class ~~ Process]) ifTrue:[
413
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   270
                                                found := true.
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   271
                                            ] ifFalse:[
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   272
                                                c := c sender.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   273
                                            ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   274
                                        ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   275
                                    ]
413
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   276
                                ]
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   277
                            ].
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   278
                            found ifFalse:[
715a6a18f825 better display of running processes context
Claus Gittinger <cg@exept.de>
parents: 409
diff changeset
   279
                                c := con
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   280
                            ].
322
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   281
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   282
                            [c notNil and:[c isBlockContext]] whileTrue:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   283
                                c := c home
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   284
                            ].
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   285
                            c notNil ifTrue:[
517
cc3d4e0fc758 examples
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   286
                                sel := c selector.
cc3d4e0fc758 examples
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   287
                                sel isNil ifTrue:[
cc3d4e0fc758 examples
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   288
                                    sel := '* unknown *'
cc3d4e0fc758 examples
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   289
                                ].
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   290
                                line nextPutAll:'  '.
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   291
                                line nextPutAll:c receiver class name.
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   292
                                line nextPutAll:'>>'; nextPutAll:sel.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   293
                            ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   294
                        ].
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   295
                        list add:line contents.
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   296
                        processes at:dIndex put:aProcess.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   297
                        dIndex := dIndex + 1
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   298
                    ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   299
                ].
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   300
            ].
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   301
            dIndex to:processes size do:[:index |
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   302
                processes at:index put:nil
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   303
            ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   304
        ].
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   305
        "avoid flicker"
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   306
        (oldList notNil and:[oldList size == list size]) ifTrue:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   307
            list keysAndValuesDo:[:idx :entry |
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   308
                (oldList at:idx) ~= entry ifTrue:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   309
                    listView at:idx put:entry
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   310
                ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   311
            ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   312
        ] ifFalse:[
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   313
            listView setList:list.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   314
            "the first two entries cannot be selected"
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   315
            listView attributeAt:1 put:#disabled.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   316
            listView attributeAt:2 put:#disabled.
314
728eab568865 Flush output when updating display.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   317
        ].
322
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   318
        listView flush
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   319
    ].
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   320
    updateBlock notNil ifTrue:[
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   321
        Processor removeTimedBlock:updateBlock.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   322
        Processor addTimedBlock:updateBlock afterSeconds:updateDelay
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   323
    ]
322
e3ccd5e431df fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
   324
656
3a625e4aa73f Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents: 619
diff changeset
   325
    "Modified: 3.7.1996 / 13:56:01 / stefan"
1009
389ee01be263 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1007
diff changeset
   326
    "Modified: 28.1.1997 / 01:37:56 / cg"
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   327
! !
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   328
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   329
!ProcessMonitor methodsFor:'initialization'!
4cde336c0794 Initial revision
claus
parents:
diff changeset
   330
4cde336c0794 Initial revision
claus
parents:
diff changeset
   331
initialize
4cde336c0794 Initial revision
claus
parents:
diff changeset
   332
    super initialize.
4cde336c0794 Initial revision
claus
parents:
diff changeset
   333
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   334
    hideDead := true.
109
claus
parents: 107
diff changeset
   335
    showDetail := Smalltalk at:#SystemDebugging ifAbsent:false.
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   336
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   337
    device hasColors ifTrue:[
315
8a86faf847d1 create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   338
        runColor := Color green.
8a86faf847d1 create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   339
        suspendedColor := Color yellow.
8a86faf847d1 create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   340
        waitColor := Color red.
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   341
    ] ifFalse:[
315
8a86faf847d1 create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   342
        runColor := suspendedColor := waitColor := Color black
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   343
    ].
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   344
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   345
    "
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   346
     ProcessMonitor open
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   347
    "
315
8a86faf847d1 create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents: 314
diff changeset
   348
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   349
    "Modified: 23.1.1997 / 02:51:38 / cg"
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   350
!
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   351
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   352
realize
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   353
    waitColor := waitColor on:device.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   354
    runColor := runColor on:device.
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   355
    suspendedColor := suspendedColor on:device.
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   356
    super realize.
56
d0cb937cbcaa *** empty log message ***
claus
parents: 52
diff changeset
   357
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   358
    "Modified: 23.1.1997 / 02:30:37 / cg"
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   359
! !
4cde336c0794 Initial revision
claus
parents:
diff changeset
   360
4cde336c0794 Initial revision
claus
parents:
diff changeset
   361
!ProcessMonitor methodsFor:'menu actions'!
4cde336c0794 Initial revision
claus
parents:
diff changeset
   362
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   363
abortProcess
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   364
    "abort (raise AbortSignal in) the selected process"
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   365
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   366
    self selectedProcessesDo:[:p |
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   367
	p interruptWith:[AbortSignal raise]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   368
    ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   369
!
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   370
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   371
debugProcess
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   372
    "open a debugger on the selected process"
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   373
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   374
    self selectedProcessesDo:[:p |
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   375
       Debugger openOn:p
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   376
    ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   377
!
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   378
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   379
hideDead:aBoolean
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   380
    "turn on/off hiding of dead (already terminated) processes"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   381
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   382
    hideDead := aBoolean
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   383
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   384
    "Modified: 23.1.1997 / 02:34:01 / cg"
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   385
!
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   386
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   387
inspectSelection
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   388
    "open an inspector on the selected process"
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   389
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   390
    self selectedProcessesSend:#inspect
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   391
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   392
    "Created: 23.1.1997 / 02:27:33 / cg"
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   393
!
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   394
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   395
lowerPrio
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   396
    "lower the selected processes priority"
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   397
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   398
    self selectedProcessesDo:[:p |
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   399
       p priority:(p priority - 1)
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   400
    ]
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   401
!
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   402
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   403
raisePrio
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   404
    "raise the selected processes priority"
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   405
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   406
    self selectedProcessesDo:[:p |
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   407
       p priority:(p priority + 1)
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   408
    ]
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   409
!
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   410
817
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   411
restartProcess
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   412
    "abort (raise AbortSignal in) the selected process"
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   413
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   414
    self selectedProcessesDo:[:p |
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   415
        p restart.
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   416
    ]
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   417
!
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   418
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   419
resumeProcess
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   420
    "resume the selected process (i.e. let it run) "
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   421
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   422
    self selectedProcessesSend:#resume
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   423
!
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   424
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   425
statusMenu
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   426
    "return a popUpMenu"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   427
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   428
    |labels selectors m sel allRestartable|
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   429
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   430
    device ctrlDown ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   431
        labels := resources array:#(
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   432
                        '\c detail'
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   433
                      ).
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   434
        selectors := #(
1003
1cefd1d13089 oops - tiggleDetail
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
   435
                        toggleDetail
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   436
                      ).
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   437
    ] ifFalse:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   438
        labels := resources array:#(
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   439
                             'inspect' 
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   440
                             'debug'  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   441
                             '-'  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   442
                             'resume'  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   443
                             'suspend'  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   444
                             'stop'  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   445
                             'abort'
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   446
                             'terminate'
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   447
                             'terminate group'
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   448
                             'restart'
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   449
                             '-'  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   450
                             'raise prio'  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   451
                             'lower prio'  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   452
                            ).
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   453
        selectors := #(
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   454
                             inspectSelection
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   455
                             debugProcess  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   456
                             nil  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   457
                             resumeProcess  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   458
                             suspendProcess  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   459
                             stopProcess  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   460
                             abortProcess
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   461
                             terminateProcess
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   462
                             terminateProcessGroup
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   463
                             restartProcess
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   464
                             nil  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   465
                             raisePrio
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   466
                             lowerPrio
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   467
                            ).
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   468
        updateProcess isNil ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   469
            labels := (resources array:#('update' '-')) , labels.
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   470
            selectors := #(updateView nil) , selectors
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   471
        ].
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   472
    ].
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   473
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   474
    m := PopUpMenu labels:labels
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   475
                   selectors:selectors.
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   476
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   477
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   478
    listView hasSelection ifFalse:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   479
        m disableAll:#(
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   480
                             inspectSelection
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   481
                             debugProcess  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   482
                             resumeProcess  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   483
                             suspendProcess  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   484
                             stopProcess  
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   485
                             restartProcess
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   486
                             abortProcess
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   487
                             terminateProcess
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   488
                             terminateProcessGroup
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   489
                             raisePrio
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   490
                             lowerPrio
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   491
                      )
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   492
    ] ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   493
        allRestartable := true.
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   494
        self selectedProcessesDo:[:p |
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   495
            p isRestartable ifFalse:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   496
                allRestartable := false
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   497
            ].
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   498
        ].
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   499
        allRestartable ifFalse:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   500
            m disable:#restartProcess
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   501
        ].
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   502
    ].
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   503
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   504
    m checkToggleAt:#toggleDetail put:showDetail.
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   505
    ^ m
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   506
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   507
    "Created: 23.1.1997 / 03:05:54 / cg"
1003
1cefd1d13089 oops - tiggleDetail
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
   508
    "Modified: 27.1.1997 / 20:41:03 / cg"
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   509
!
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   510
92
claus
parents: 90
diff changeset
   511
stopProcess
claus
parents: 90
diff changeset
   512
    "stop the selected process - not even interrupts will wake it up"
claus
parents: 90
diff changeset
   513
claus
parents: 90
diff changeset
   514
    self selectedProcessesSend:#stop
claus
parents: 90
diff changeset
   515
!
claus
parents: 90
diff changeset
   516
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   517
suspendProcess
92
claus
parents: 90
diff changeset
   518
    "suspend the selected process - interrupts will let it run again"
claus
parents: 90
diff changeset
   519
58
43b7d463a7e5 *** empty log message ***
claus
parents: 57
diff changeset
   520
    self selectedProcessesSend:#suspend
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   521
!
45
950b84ba89e6 *** empty log message ***
claus
parents: 19
diff changeset
   522
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   523
terminateProcess
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   524
    "terminate the selected process"
92
claus
parents: 90
diff changeset
   525
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   526
    self selectedProcessesSend:#terminate
663
befe6a1d886f show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   527
!
befe6a1d886f show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   528
befe6a1d886f show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   529
terminateProcessGroup
817
a2c25d3e8186 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 775
diff changeset
   530
    "terminate the selected process with all of its subprocesses"
663
befe6a1d886f show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   531
befe6a1d886f show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   532
    self selectedProcessesSend:#terminateGroup
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   533
!
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   534
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   535
toggleDetail
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   536
    "toggle detail"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   537
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   538
    showDetail := showDetail not.
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   539
    self updateView
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   540
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   541
    "Modified: 23.1.1997 / 02:33:03 / cg"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   542
    "Created: 23.1.1997 / 02:33:30 / cg"
19
4cde336c0794 Initial revision
claus
parents:
diff changeset
   543
! !
4cde336c0794 Initial revision
claus
parents:
diff changeset
   544
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   545
!ProcessMonitor methodsFor:'private'!
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   546
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   547
selectedProcessesDo:aBlock
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   548
    "evaluate aBlock on all selected processes"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   549
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   550
    |p nr sel|
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   551
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   552
    sel := listView selection.
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   553
    sel isNil ifTrue:[^ self].
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   554
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   555
    (sel isKindOf:Collection) ifTrue:[
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   556
        sel do:[:n |
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   557
            nr := n - 2.   "for headlines"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   558
            nr notNil ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   559
                nr > 0 ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   560
                    p := processes at:nr.
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   561
                    (p notNil and:[p ~~ 0]) ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   562
                       aBlock value:p
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   563
                    ]
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   564
                ]
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   565
            ]
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   566
        ]
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   567
    ] ifFalse:[
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   568
        nr := sel - 2.     "for headlines"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   569
        nr notNil ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   570
            nr > 0 ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   571
                p := processes at:nr.
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   572
                (p notNil and:[p ~~ 0]) ifTrue:[
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   573
                   aBlock value:p
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   574
                ]
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   575
            ]
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   576
        ]
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   577
    ].
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   578
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   579
    "Modified: 23.1.1997 / 03:10:53 / cg"
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   580
!
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   581
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   582
selectedProcessesSend:aSelector
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   583
    "send a message to all selected processes"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   584
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   585
    self selectedProcessesDo:[:p |
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   586
        p perform:aSelector
143
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   587
    ].
95c177bc7678 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
   588
    self updateView.
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   589
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   590
    "Modified: 23.1.1997 / 02:34:49 / cg"
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   591
! !
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   592
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   593
!ProcessMonitor methodsFor:'user actions'!
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   594
979
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   595
doubleClicked
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   596
    "open a debugger on the selected process"
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   597
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   598
    self debugProcess
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   599
c1e318bee326 extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents: 817
diff changeset
   600
    "Created: 23.1.1997 / 03:21:30 / cg"
85
d9713a3ca092 *** empty log message ***
claus
parents: 58
diff changeset
   601
! !
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   602
771
5cd10b4845f3 oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   603
!ProcessMonitor class methodsFor:'documentation'!
208
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   604
c79225d671c3 better detail info
Claus Gittinger <cg@exept.de>
parents: 166
diff changeset
   605
version
1053
9b1b15ef1e34 category change
Claus Gittinger <cg@exept.de>
parents: 1052
diff changeset
   606
    ^ '$Header: /cvs/stx/stx/libtool/ProcessMonitor.st,v 1.51 1997-03-02 10:23:38 cg Exp $'
9b1b15ef1e34 category change
Claus Gittinger <cg@exept.de>
parents: 1052
diff changeset
   607
! !