SystemStatusMonitor.st
changeset 1897 76292e485360
parent 1823 6ebeee55f0c4
child 2410 292d61292ac8
equal deleted inserted replaced
1896:e92534f5dfb7 1897:76292e485360
    80 
    80 
    81 keyPress:key x:x y:y
    81 keyPress:key x:x y:y
    82     <resource: #keyboard ( #InspectIt ) >
    82     <resource: #keyboard ( #InspectIt ) >
    83 
    83 
    84     key == #InspectIt ifTrue:[
    84     key == #InspectIt ifTrue:[
    85         ^ self inspectSelection.
    85 	^ self inspectSelection.
    86     ].
    86     ].
    87     ^ super keyPress:key x:x y:y
    87     ^ super keyPress:key x:x y:y
    88 
    88 
    89     "Modified: 23.1.1997 / 02:27:27 / cg"
    89     "Modified: 23.1.1997 / 02:27:27 / cg"
    90     "Created: 23.1.1997 / 02:27:45 / cg"
    90     "Created: 23.1.1997 / 02:27:45 / cg"
   103     listView := v scrolledView.
   103     listView := v scrolledView.
   104     listView font:(EditTextView defaultFont).
   104     listView font:(EditTextView defaultFont).
   105     listView menuHolder:self; menuPerformer:self; menuMessage:#statusMenu. 
   105     listView menuHolder:self; menuPerformer:self; menuMessage:#statusMenu. 
   106 
   106 
   107     listView multipleSelectOk:true.
   107     listView multipleSelectOk:true.
   108     listView toggleSelect:true.
   108     "/ listView toggleSelect:true.
   109     listView delegate:(KeyboardForwarder toView:self).
   109     listView delegate:(KeyboardForwarder toView:self).
   110     listView doubleClickAction:[:line | self doubleClicked].
   110     listView doubleClickAction:[:line | self doubleClicked].
   111 
   111 
   112     updateDelay := 0.5.
   112     updateDelay := 0.5.
   113     listUpdateDelay := 5.
   113     listUpdateDelay := 5.
   114 
   114 
   115     "/ event mode is no longer used;
   115     "/ event mode is no longer used;
   116     "/ this event support may vanish
   116     "/ this event support may vanish
   117     Processor isPureEventDriven ifTrue:[
   117     Processor isPureEventDriven ifTrue:[
   118         updateBlock := [self updateStatus].
   118 	updateBlock := [self updateStatus].
   119         listUpdateBlock := [self updateList].
   119 	listUpdateBlock := [self updateList].
   120     ].
   120     ].
   121 
   121 
   122     "
   122     "
   123      ProcessMonitor open
   123      ProcessMonitor open
   124     "
   124     "
   151     "Created: 23.1.1997 / 02:30:43 / cg"
   151     "Created: 23.1.1997 / 02:30:43 / cg"
   152 !
   152 !
   153 
   153 
   154 startUpdateProcess
   154 startUpdateProcess
   155     updateBlock notNil ifTrue:[
   155     updateBlock notNil ifTrue:[
   156         Processor addTimedBlock:updateBlock afterSeconds:updateDelay.
   156 	Processor addTimedBlock:updateBlock afterSeconds:updateDelay.
   157         Processor addTimedBlock:listUpdateBlock afterSeconds:listUpdateDelay.
   157 	Processor addTimedBlock:listUpdateBlock afterSeconds:listUpdateDelay.
   158     ] ifFalse:[
   158     ] ifFalse:[
   159         updateProcess := [
   159 	updateProcess := [
   160             [
   160 	    [
   161                 |id cnt myDelay|
   161 		|id cnt myDelay|
   162 
   162 
   163                 myDelay := Delay forSeconds:0.5.
   163 		myDelay := Delay forSeconds:0.5.
   164 
   164 
   165                 "
   165 		"
   166                  every 20ms, we look which process runs;
   166 		 every 20ms, we look which process runs;
   167                  every half second, the status is updated.
   167 		 every half second, the status is updated.
   168                  every 5 seconds, the list of processes is
   168 		 every 5 seconds, the list of processes is
   169                  built up again
   169 		 built up again
   170                 "
   170 		"
   171                 [true] whileTrue:[
   171 		[true] whileTrue:[
   172                     1 to:9 do:[:i |
   172 		    1 to:9 do:[:i |
   173 "/                        cpuUsages := IdentityDictionary new.
   173 "/                        cpuUsages := IdentityDictionary new.
   174 "/                        1 to:25 do:[:i |
   174 "/                        1 to:25 do:[:i |
   175 "/                            (Delay forSeconds:0.02) wait.
   175 "/                            (Delay forSeconds:0.02) wait.
   176 "/                            id := Processor interruptedProcess id.
   176 "/                            id := Processor interruptedProcess id.
   177 "/                            cnt := cpuUsages at:id ifAbsent:[0].
   177 "/                            cnt := cpuUsages at:id ifAbsent:[0].
   178 "/                            cpuUsages at:id put:cnt + 1.
   178 "/                            cpuUsages at:id put:cnt + 1.
   179 "/                        ].
   179 "/                        ].
   180                         myDelay wait.
   180 			myDelay wait.
   181                         self updateStatus.
   181 			self updateStatus.
   182                     ].
   182 		    ].
   183                     myDelay wait.
   183 		    myDelay wait.
   184                     self updateList.
   184 		    self updateList.
   185                 ]
   185 		]
   186             ] valueOnUnwindDo:[
   186 	    ] valueOnUnwindDo:[
   187                 updateProcess := nil
   187 		updateProcess := nil
   188             ]
   188 	    ]
   189         ]  forkAt:(Processor userSchedulingPriority + 1).
   189 	]  forkAt:(Processor userSchedulingPriority + 1).
   190         updateProcess name:'monitor [' , 
   190 	updateProcess name:'monitor [' , 
   191                            Processor activeProcess id printString ,
   191 			   Processor activeProcess id printString ,
   192                            '] update'.
   192 			   '] update'.
   193         "
   193 	"
   194          raise my own priority
   194 	 raise my own priority
   195         "
   195 	"
   196         Processor activeProcess priority:(Processor userSchedulingPriority + 2)
   196 	Processor activeProcess priority:(Processor userSchedulingPriority + 2)
   197     ].
   197     ].
   198 
   198 
   199     "Created: 23.1.1997 / 02:30:58 / cg"
   199     "Created: 23.1.1997 / 02:30:58 / cg"
   200     "Modified: 24.1.1997 / 21:40:11 / cg"
   200     "Modified: 24.1.1997 / 21:40:11 / cg"
   201 ! !
   201 ! !
   212 ! !
   212 ! !
   213 
   213 
   214 !SystemStatusMonitor class methodsFor:'documentation'!
   214 !SystemStatusMonitor class methodsFor:'documentation'!
   215 
   215 
   216 version
   216 version
   217     ^ '$Header: /cvs/stx/stx/libtool/SystemStatusMonitor.st,v 1.7 1998-08-10 14:03:50 cg Exp $'
   217     ^ '$Header: /cvs/stx/stx/libtool/SystemStatusMonitor.st,v 1.8 1998-09-24 10:08:08 cg Exp $'
   218 ! !
   218 ! !