19273
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1997 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libtool' }"
|
|
13 |
|
|
14 |
"{ NameSpace: Smalltalk }"
|
|
15 |
|
|
16 |
SystemStatusMonitor subclass:#TimerQueueMonitor
|
|
17 |
instanceVariableNames:'timeouts showTime'
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Monitors-ST/X'
|
|
21 |
!
|
|
22 |
|
|
23 |
!TimerQueueMonitor class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 1997 by Claus Gittinger
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
|
|
38 |
|
|
39 |
!
|
|
40 |
|
|
41 |
documentation
|
|
42 |
"
|
|
43 |
This view shows smalltalk's external stream instances - a debugging tool.
|
|
44 |
|
|
45 |
[disclaimer:]
|
|
46 |
this is based on one of the oldest tools in the system, written in the early 90's.
|
|
47 |
It does in no way reflect the way GUIs are designed/written these days.
|
|
48 |
However, after all those years, they are still very very useful (and not found in many other systems)
|
|
49 |
|
|
50 |
[see also:]
|
|
51 |
Stream ExternalStream
|
|
52 |
WindowGroup
|
|
53 |
ProcessMonitor
|
|
54 |
SemaphoreMonitor OSProcessMonitor
|
|
55 |
|
|
56 |
[author:]
|
|
57 |
Claus Gittinger
|
|
58 |
|
|
59 |
[start with:]
|
|
60 |
ExternalStreamMonitor open
|
|
61 |
"
|
|
62 |
! !
|
|
63 |
|
|
64 |
!TimerQueueMonitor class methodsFor:'defaults'!
|
|
65 |
|
|
66 |
defaultLabel
|
|
67 |
^ 'External Streams Monitor'
|
|
68 |
|
|
69 |
"Created: 23.1.1997 / 02:52:53 / cg"
|
|
70 |
! !
|
|
71 |
|
|
72 |
!TimerQueueMonitor class methodsFor:'menu specs'!
|
|
73 |
|
|
74 |
mainMenu
|
|
75 |
"This resource specification was automatically generated
|
|
76 |
by the MenuEditor of ST/X."
|
|
77 |
|
|
78 |
"Do not manually edit this!! If it is corrupted,
|
|
79 |
the MenuEditor may not be able to read the specification."
|
|
80 |
|
|
81 |
|
|
82 |
"
|
|
83 |
MenuEditor new openOnClass:TimerQueueMonitor andSelector:#mainMenu
|
|
84 |
(Menu new fromLiteralArrayEncoding:(TimerQueueMonitor mainMenu)) startUp
|
|
85 |
"
|
|
86 |
|
|
87 |
<resource: #menu>
|
|
88 |
|
|
89 |
^
|
|
90 |
#(Menu
|
|
91 |
(MenuItem
|
|
92 |
label: 'File'
|
|
93 |
submenuChannel: fileMenu
|
|
94 |
)
|
|
95 |
(MenuItem
|
|
96 |
label: 'View'
|
|
97 |
submenuChannel: viewMenu
|
|
98 |
)
|
|
99 |
)
|
|
100 |
! !
|
|
101 |
|
|
102 |
!TimerQueueMonitor methodsFor:'initialization'!
|
|
103 |
|
|
104 |
initialize
|
|
105 |
super initialize.
|
|
106 |
showTime := true.
|
|
107 |
! !
|
|
108 |
|
|
109 |
!TimerQueueMonitor methodsFor:'queries'!
|
|
110 |
|
|
111 |
numberOfHeadlines
|
|
112 |
^ 2 + (showTime == true ifTrue:1 ifFalse:0)
|
|
113 |
|
|
114 |
"Modified: / 29-10-2018 / 15:24:14 / Claus Gittinger"
|
|
115 |
! !
|
|
116 |
|
|
117 |
!TimerQueueMonitor methodsFor:'updating'!
|
|
118 |
|
|
119 |
titleLine
|
|
120 |
^ 'When Process Action/Semaphore'.
|
|
121 |
|
|
122 |
"
|
|
123 |
TimeQueueMonitor open
|
|
124 |
"
|
|
125 |
!
|
|
126 |
|
|
127 |
updateList
|
|
128 |
"update list of timeouts"
|
|
129 |
|
|
130 |
|newInfo t list|
|
|
131 |
|
|
132 |
shown ifTrue:[
|
|
133 |
newInfo := Processor timeoutList.
|
|
134 |
self updateStatus:newInfo
|
|
135 |
].
|
|
136 |
self installDelayedUpdate.
|
|
137 |
|
|
138 |
"Modified: / 29-10-2018 / 15:39:43 / Claus Gittinger"
|
|
139 |
!
|
|
140 |
|
|
141 |
updateStatus:newInfo
|
|
142 |
"update status display of timeouts"
|
|
143 |
|
|
144 |
|numberOfHeadlines newTimeoutList oldList list oldSelection newSelection osTimeStampOfList|
|
|
145 |
|
|
146 |
newInfo isNil ifTrue:[^ self].
|
|
147 |
|
|
148 |
shown ifTrue:[
|
|
149 |
osTimeStampOfList := newInfo first.
|
|
150 |
newTimeoutList := newInfo second.
|
|
151 |
newTimeoutList sort:[:t1 :t2 | (t1 at:'time') < (t2 at:'time') ].
|
|
152 |
|
|
153 |
numberOfHeadlines := self numberOfHeadlines.
|
|
154 |
oldList := listView list.
|
|
155 |
"/ oldSelection := listView selection.
|
|
156 |
"/ oldSelection notNil ifTrue:[
|
|
157 |
"/ oldSelection := oldSelection
|
|
158 |
"/ select:[:lNr | lNr > numberOfHeadlines]
|
|
159 |
"/ thenCollect:[:lineNr |
|
|
160 |
"/ timeouts at:(lineNr - numberOfHeadlines) ifAbsent:nil
|
|
161 |
"/ ].
|
|
162 |
"/ newSelection := OrderedCollection new.
|
|
163 |
"/ ].
|
|
164 |
|
|
165 |
list := OrderedCollection new:(newTimeoutList size + numberOfHeadlines).
|
|
166 |
(showTime == true) ifTrue:[
|
|
167 |
list add:'Time: ',(Time now printString).
|
|
168 |
].
|
|
169 |
list add:self titleLine.
|
|
170 |
list add:(String new:(self titleLine size+20) withAll:$-).
|
|
171 |
|
|
172 |
newTimeoutList notNil ifTrue:[
|
|
173 |
newTimeoutList do:[:aTimeout |
|
|
174 |
|time process processName action actionName sema semaName deltaTime
|
|
175 |
color line|
|
|
176 |
|
|
177 |
time := aTimeout at:'time'.
|
|
178 |
action := aTimeout at:'action'.
|
|
179 |
process := aTimeout at:'process'.
|
|
180 |
sema := aTimeout at:'sema'.
|
|
181 |
|
|
182 |
processName := process isNil ifTrue:[''] ifFalse:[process name].
|
|
183 |
actionName := action isNil ifTrue:[''] ifFalse:[action printString].
|
|
184 |
semaName := sema isNil ifTrue:[''] ifFalse:[sema displayString].
|
|
185 |
|
|
186 |
deltaTime := TimeDuration milliseconds:(time - osTimeStampOfList).
|
|
187 |
|
|
188 |
line := (deltaTime printString) paddedTo:10.
|
|
189 |
line := line , ' ' , ((processName contractTo:40) paddedTo:40).
|
|
190 |
action notNil ifTrue:[
|
|
191 |
line := line , ' ' , ((actionName contractTo:40) paddedTo:40).
|
|
192 |
] ifFalse:[
|
|
193 |
line := line , ' ' , ((semaName contractTo:40) paddedTo:40).
|
|
194 |
].
|
|
195 |
|
|
196 |
"/ isOpen ifFalse:[
|
|
197 |
"/ color := Color red.
|
|
198 |
"/ ] ifTrue:[
|
|
199 |
"/ color := Color blue.
|
|
200 |
"/ ].
|
|
201 |
"/ line := line withColor:color.
|
|
202 |
|
|
203 |
list add:line.
|
|
204 |
"/ oldSelection notNil ifTrue:[
|
|
205 |
"/ (oldSelection includesIdentical:aStream) ifTrue:[
|
|
206 |
"/ newSelection add:list size.
|
|
207 |
"/ ]
|
|
208 |
"/ ]
|
|
209 |
].
|
|
210 |
].
|
|
211 |
|
|
212 |
"avoid flicker"
|
|
213 |
(oldList notNil and:[oldList size == list size]) ifTrue:[
|
|
214 |
list keysAndValuesDo:[:idx :entry |
|
|
215 |
(oldList at:idx) ~= entry ifTrue:[
|
|
216 |
listView at:idx put:entry
|
|
217 |
]
|
|
218 |
]
|
|
219 |
] ifFalse:[
|
|
220 |
listView setList:list.
|
|
221 |
"the first few entries cannot be selected"
|
|
222 |
1 to:numberOfHeadlines do:[:lNr | listView attributeAt:lNr put:#disabled].
|
|
223 |
].
|
|
224 |
newSelection notNil ifTrue:[
|
|
225 |
listView selectWithoutScroll:newSelection
|
|
226 |
].
|
|
227 |
listView flush
|
|
228 |
].
|
|
229 |
self installDelayedUpdate.
|
|
230 |
|
|
231 |
"Modified: / 11-10-2017 / 13:56:14 / cg"
|
|
232 |
"Modified: / 07-06-2019 / 22:10:36 / Claus Gittinger"
|
|
233 |
! !
|
|
234 |
|
|
235 |
!TimerQueueMonitor class methodsFor:'documentation'!
|
|
236 |
|
|
237 |
version_CVS
|
|
238 |
^ '$Header$'
|
|
239 |
! !
|
|
240 |
|