3926 ! |
3924 ! |
3927 |
3925 |
3928 updateStatus:newProcessList |
3926 updateStatus:newProcessList |
3929 |startTime endTime deltaT| |
3927 |startTime endTime deltaT| |
3930 |
3928 |
3931 startTime := Timestamp now. |
3929 self window shown ifTrue:[ |
3932 updateSema critical:[ |
3930 startTime := Timestamp now. |
3933 self updateTable:newProcessList. |
3931 updateSema critical:[ |
3934 ]. |
3932 self updateTable:newProcessList. |
3935 |
3933 ]. |
3936 endTime := Timestamp now. |
3934 |
3937 |
3935 endTime := Timestamp now. |
3938 lastUpdateTimestamp notNil ifTrue:[ |
3936 |
3939 |timeDelta newInterruptCount newTimerActionCount n nPerSecond s| |
3937 lastUpdateTimestamp notNil ifTrue:[ |
3940 |
3938 |timeDelta newInterruptCount newTimerActionCount n nPerSecond s| |
3941 timeDelta := (endTime - lastUpdateTimestamp) asMilliseconds / 1000.0. |
3939 |
3942 |
3940 timeDelta := (endTime - lastUpdateTimestamp) asMilliseconds / 1000.0. |
3943 "/ update the interrupt counts |
3941 |
3944 newInterruptCount := Processor interruptCounter. |
3942 "/ update the interrupt counts |
3945 newTimerActionCount := Processor timedActionCounter. |
3943 newInterruptCount := Processor interruptCounter. |
3946 lastInterruptCount notNil ifTrue:[ |
3944 newTimerActionCount := Processor timedActionCounter. |
3947 "/ attention - these are modulu counters. |
3945 lastInterruptCount notNil ifTrue:[ |
3948 newInterruptCount >= lastInterruptCount ifTrue:[ |
3946 "/ attention - these are modulu counters. |
3949 n := newInterruptCount-lastInterruptCount. |
3947 newInterruptCount >= lastInterruptCount ifTrue:[ |
3950 n == 0 ifTrue:[ |
3948 n := newInterruptCount-lastInterruptCount. |
3951 "/ the common case |
3949 n == 0 ifTrue:[ |
3952 s := '0' |
3950 "/ the common case |
3953 ] ifFalse:[ |
3951 s := '0' |
3954 nPerSecond := n / timeDelta. |
3952 ] ifFalse:[ |
3955 s := (nPerSecond asInteger "asFixedPoint:1") printString |
3953 nPerSecond := n / timeDelta. |
|
3954 s := (nPerSecond asInteger "asFixedPoint:1") printString |
|
3955 ]. |
|
3956 self interruptCountHolder value:s |
3956 ]. |
3957 ]. |
3957 self interruptCountHolder value:s |
3958 ]. |
3958 ]. |
3959 lastTimerActionCount notNil ifTrue:[ |
|
3960 "/ attention - these are modulu counters. |
|
3961 newTimerActionCount >= lastTimerActionCount ifTrue:[ |
|
3962 n := newTimerActionCount-lastTimerActionCount. |
|
3963 n == 0 ifTrue:[ |
|
3964 "/ the common case |
|
3965 s := '0' |
|
3966 ] ifFalse:[ |
|
3967 nPerSecond := n / timeDelta. |
|
3968 s := (nPerSecond asInteger "asFixedPoint:1") printString |
|
3969 ]. |
|
3970 self timerActionCountHolder value:s |
|
3971 ]. |
|
3972 ]. |
|
3973 |
|
3974 lastInterruptCount := newInterruptCount. |
|
3975 lastTimerActionCount := newTimerActionCount. |
3959 ]. |
3976 ]. |
3960 lastTimerActionCount notNil ifTrue:[ |
3977 lastUpdateTimestamp := endTime. |
3961 "/ attention - these are modulu counters. |
3978 |
3962 newTimerActionCount >= lastTimerActionCount ifTrue:[ |
3979 "/ a check, in case the computation took longer than 20% |
3963 n := newTimerActionCount-lastTimerActionCount. |
3980 "/ of the delay time. Then increase the update interval. |
3964 n == 0 ifTrue:[ |
3981 "/ This is to avoid that the processMonitor creates too much overhead |
3965 "/ the common case |
3982 "/ (in case we have many processes) |
3966 s := '0' |
3983 deltaT := (endTime millisecondDeltaFrom:startTime) / 1000.0. |
3967 ] ifFalse:[ |
3984 "/ Transcript show:deltaT; show:' ' ; showCR:(self scaledUpdateContentsDelayTime / 10.0). |
3968 nPerSecond := n / timeDelta. |
3985 deltaT > (updateDelay / 5) ifTrue:[ |
3969 s := (nPerSecond asInteger "asFixedPoint:1") printString |
3986 "/ the update took longer than 20% - make delay longer, to reduce cpu load. |
3970 ]. |
3987 updateDelay := updateDelay * 2. |
3971 self timerActionCountHolder value:s |
3988 self updateContentsDelayTimeHolder value:updateDelay. |
3972 ]. |
3989 "/ Transcript show:'+++ '; showCR:self scaledUpdateContentsDelayTime. |
3973 ]. |
3990 ]. |
3974 |
|
3975 lastInterruptCount := newInterruptCount. |
|
3976 lastTimerActionCount := newTimerActionCount. |
|
3977 ]. |
|
3978 lastUpdateTimestamp := endTime. |
|
3979 |
|
3980 "/ a check, in case the computation took longer than 20% |
|
3981 "/ of the delay time. Then increase the update interval. |
|
3982 "/ This is to avoid that the processMonitor creates too much overhead |
|
3983 "/ (in case we have many processes) |
|
3984 deltaT := (endTime millisecondDeltaFrom:startTime) / 1000.0. |
|
3985 "/ Transcript show:deltaT; show:' ' ; showCR:(self scaledUpdateContentsDelayTime / 10.0). |
|
3986 deltaT > (updateDelay / 5) ifTrue:[ |
|
3987 "/ the update took longer than 20% - make delay longer, to reduce cpu load. |
|
3988 updateDelay := updateDelay * 2. |
|
3989 self updateContentsDelayTimeHolder value:updateDelay. |
|
3990 "/ Transcript show:'+++ '; showCR:self scaledUpdateContentsDelayTime. |
|
3991 ]. |
3991 ]. |
3992 |
3992 |
3993 updateBlock notNil ifTrue:[ |
3993 updateBlock notNil ifTrue:[ |
3994 Processor removeTimedBlock:updateBlock. |
3994 Processor removeTimedBlock:updateBlock. |
3995 Processor addTimedBlock:updateBlock afterSeconds:updateDelay. |
3995 Processor addTimedBlock:updateBlock afterSeconds:updateDelay. |
3996 ] |
3996 ] |
|
3997 |
|
3998 "Modified: / 04-11-2018 / 10:49:20 / Claus Gittinger" |
3997 ! |
3999 ! |
3998 |
4000 |
3999 updateTable:newProcessList |
4001 updateTable:newProcessList |
4000 |oldSelection newList sel diff weakProcessList showDead| |
4002 |oldSelection newList sel diff weakProcessList showDead| |
4001 |
4003 |