3487 a higher level waiter, such as a semaphore wait, a shared queue wait etc." |
3491 a higher level waiter, such as a semaphore wait, a shared queue wait etc." |
3488 |
3492 |
3489 |c found skipping rs rc r sel| |
3493 |c found skipping rs rc r sel| |
3490 |
3494 |
3491 con notNil ifTrue:[ |
3495 con notNil ifTrue:[ |
3492 c := con. |
3496 c := con. |
3493 found := false. |
3497 found := false. |
3494 isRunning ifFalse:[ |
3498 isRunning ifFalse:[ |
3495 "/ search for a semaphore-wait in the top 10 contexts |
3499 "/ search for a semaphore-wait in the top 10 contexts |
3496 1 to:10 do:[:n | |
3500 1 to:10 do:[:n | |
3497 found ifFalse:[ |
3501 found ifFalse:[ |
3498 c notNil ifTrue:[ |
3502 c notNil ifTrue:[ |
3499 (c receiver class == Semaphore) ifTrue:[ |
3503 (c receiver class == Semaphore) ifTrue:[ |
3500 c selector == #wait ifTrue:[ |
3504 ((sel := c selector) == #wait |
3501 found := true. |
3505 or:[sel == #waitWithTimeout: |
3502 ]. |
3506 or:[sel == #waitWithTimeoutMs:]] |
3503 c selector == #waitWithTimeout: ifTrue:[ |
3507 ) ifTrue:[ |
3504 found := true. |
3508 found := true. |
3505 ]. |
3509 ]. |
3506 c selector == #waitWithTimeoutMs: ifTrue:[ |
3510 ]. |
3507 found := true. |
3511 c := c sender. |
3508 ]. |
3512 ] |
3509 ]. |
3513 ] |
3510 c := c sender. |
3514 ]. |
3511 ] |
3515 ]. |
3512 ] |
3516 found ifFalse:[ |
3513 ]. |
3517 "/ search for a non-processor, non-process |
3514 ]. |
3518 "/ receiver in the top 10 contexts |
3515 found ifFalse:[ |
3519 c := con. |
3516 "/ search for a non-processor, non-process |
3520 1 to:10 do:[:n | |
3517 "/ receiver in the top 10 contexts |
3521 found ifFalse:[ |
3518 c := con. |
3522 c notNil ifTrue:[ |
3519 1 to:10 do:[:n | |
3523 ((r := c receiver) ~~ Processor and:[ r class ~~ Process ]) ifTrue:[ |
3520 found ifFalse:[ |
3524 found := true. |
3521 c notNil ifTrue:[ |
3525 ] ifFalse:[ |
3522 ((r := c receiver) ~~ Processor and:[ r class ~~ Process ]) ifTrue:[ |
3526 c := c sender. |
3523 found := true. |
3527 ] |
3524 ] ifFalse:[ |
3528 ] |
3525 c := c sender. |
3529 ] |
3526 ] |
3530 ] |
3527 ] |
3531 ]. |
3528 ] |
3532 |
3529 ] |
3533 "/ skip, until an interesting context is found. |
3530 ]. |
3534 "/ This skips intermediate contexts, which lead |
3531 |
3535 "/ to the sema-wait (for example, unwind blocks, delay-stuff etc.) |
3532 "/ skip, until an interesting context is found. |
3536 found ifFalse:[ |
3533 "/ This skips intermediate contexts, which lead |
3537 c := con |
3534 "/ to the sema-wait (for example, unwind blocks, delay-stuff etc.) |
3538 ]. |
3535 found ifFalse:[ |
3539 skipping := true. |
3536 c := con |
3540 [ skipping ] whileTrue:[ |
3537 ]. |
3541 skipping := false. |
3538 skipping := true. |
3542 (c notNil and:[ (r := c receiver) == Delay or:[ r class == Delay ] ]) ifTrue:[ |
3539 [ skipping ] whileTrue:[ |
3543 c := c sender. |
3540 skipping := false. |
3544 skipping := true. |
3541 (c notNil and:[ c receiver == Delay or:[ c receiver class == Delay ] ]) ifTrue:[ |
3545 ]. |
3542 c := c sender. |
3546 (c notNil and:[ (r := c receiver) == Semaphore or:[ r class == Semaphore ] ]) ifTrue:[ |
3543 skipping := true. |
3547 c := c sender. |
3544 ]. |
3548 skipping := true. |
3545 (c notNil and:[ c receiver == Semaphore or:[ c receiver class == Semaphore ] ]) ifTrue:[ |
3549 ]. |
3546 c := c sender. |
3550 [ |
3547 skipping := true. |
3551 c notNil |
3548 ]. |
3552 and:[ c receiver isBlock |
3549 [ |
3553 and:[ ((sel := c selector) startsWith:'value') |
3550 c notNil |
3554 or:[ sel = 'doWhile:' |
3551 and:[ c receiver isBlock |
3555 or:[ sel = 'doUntil:' |
3552 and:[ (c selector startsWith:'value') |
3556 or:[ sel = 'ensure:' ]]]]] |
3553 or:[ c selector = 'doWhile:' |
3557 ] whileTrue:[ |
3554 or:[ c selector = 'doUntil:' |
3558 c := c sender. |
3555 or:[ c selector = 'ensure:' ]]]]] |
3559 skipping := true. |
3556 ] whileTrue:[ |
3560 ]. |
3557 c := c sender. |
3561 [ |
3558 skipping := true. |
3562 c notNil |
3559 ]. |
3563 and:[ c receiver == OperatingSystem |
3560 [ |
3564 and:[ c selector == #unblockInterrupts ] ] |
3561 c notNil |
3565 ] whileTrue:[ |
3562 and:[ c receiver == OperatingSystem and:[ c selector == #unblockInterrupts ] ] |
3566 c := c sender. |
3563 ] whileTrue:[ |
3567 skipping := true. |
3564 c := c sender. |
3568 ]. |
3565 skipping := true. |
3569 [ |
3566 ]. |
3570 c notNil and:[ c isBlockContext ] |
3567 [ |
3571 ] whileTrue:[ |
3568 c notNil and:[ c isBlockContext ] |
3572 c := c home. |
3569 ] whileTrue:[ |
3573 skipping := true. |
3570 c := c home. |
3574 ]. |
3571 skipping := true. |
3575 ]. |
3572 ]. |
3576 c notNil ifTrue:[ |
3573 ]. |
3577 sel := c selector. |
3574 c notNil ifTrue:[ |
3578 sel isNil ifTrue:[ |
3575 sel := c selector. |
3579 sel := '* unknown *' |
3576 sel isNil ifTrue:[ |
3580 ]. |
3577 sel := '* unknown *' |
3581 r := c receiver. |
3578 ]. |
3582 rc := r class. |
3579 r := c receiver. |
3583 rs := rc name. |
3580 rc := r class. |
3584 (rc == SharedQueue |
3581 rs := rc name. |
3585 or:[rc == RecursionLock]) ifTrue:[ |
3582 (rc == SharedQueue |
3586 rs := rs , ' (', (r identityHash bitShift:-12) hexPrintString,') '. |
3583 or:[rc == RecursionLock]) ifTrue:[ |
3587 ]. |
3584 rs := rs , ' (', (r identityHash bitShift:-12) hexPrintString,') '. |
3588 ^ (rs , '>>' , sel). |
3585 ]. |
3589 ] |
3586 ^ (rs , '>>' , sel). |
|
3587 ] |
|
3588 ]. |
3590 ]. |
3589 ^ '' |
3591 ^ '' |
3590 |
3592 |
3591 "Modified: / 28-02-2012 / 11:43:30 / cg" |
3593 "Modified: / 28-02-2012 / 11:43:30 / cg" |
|
3594 "Modified: / 12-03-2019 / 17:54:47 / Claus Gittinger" |
3592 ! |
3595 ! |
3593 |
3596 |
3594 getWindowTitleFor:aProcess |
3597 getWindowTitleFor:aProcess |
3595 |wg topViews| |
3598 |wg topViews| |
3596 |
3599 |
3657 ! ! |
3660 ! ! |
3658 |
3661 |
3659 !ProcessMonitorV2 methodsFor:'update process'! |
3662 !ProcessMonitorV2 methodsFor:'update process'! |
3660 |
3663 |
3661 fillItemInformationIn:processItem |
3664 fillItemInformationIn:processItem |
3662 |state stateColor running con aProcess| |
3665 |state stateColor stateString running con aProcess group| |
3663 |
3666 |
3664 aProcess := processItem processInstance. |
3667 aProcess := processItem processInstance. |
3665 aProcess isNil ifTrue:[ |
3668 aProcess isNil ifTrue:[ |
3666 ^ self. |
3669 ^ self. |
3667 ]. |
3670 ]. |
3668 |
3671 group := self getGroupStringFor:aProcess. |
3669 processItem processId:aProcess id. |
3672 |
3670 processItem idVal:aProcess id ? -1. |
|
3671 |
|
3672 processItem processGroup:(self getGroupStringFor:aProcess). |
|
3673 processItem groupVal:(processItem processGroup isNumber ifTrue:[processItem processGroup] ifFalse:[-1]). |
|
3674 |
|
3675 processItem processStartTime:aProcess startTimestamp. |
|
3676 processItem processName:aProcess name ? ''. |
|
3677 |
|
3678 state := aProcess state. |
3673 state := aProcess state. |
3679 running := (state == #run and:[aProcess == Processor interruptedProcess]). |
3674 running := (state == #run and:[aProcess == Processor interruptedProcess]). |
3680 |
|
3681 stateColor := (state == #run) |
3675 stateColor := (state == #run) |
3682 ifTrue:[ Color green darkened ] |
3676 ifTrue:[ Color green darkened ] |
3683 ifFalse:[ |
3677 ifFalse:[ |
3684 (state == #debug or:[state == #stopped]) |
3678 (state == #debug or:[state == #stopped]) |
3685 ifTrue:[ Color red ] |
3679 ifTrue:[ Color red ] |
3686 ifFalse:[ Color black ]]. |
3680 ifFalse:[ Color black ]]. |
3687 |
3681 stateString := state asString withColor:stateColor. |
3688 processItem processState:(state asString withColor:stateColor). |
3682 |
|
3683 processItem |
|
3684 processId:(aProcess id) |
|
3685 idVal:(aProcess id ? -1) |
|
3686 processGroup:group |
|
3687 groupVal:(group isNumber ifTrue:[group] ifFalse:[-1]) |
|
3688 processStartTime:aProcess startTimestamp |
|
3689 processName:(aProcess name ? '') |
|
3690 processState:stateString. |
|
3691 |
3689 processItem processActive:(self getActiveStringFor:aProcess running:running). |
3692 processItem processActive:(self getActiveStringFor:aProcess running:running). |
3690 |
3693 |
3691 "/ processItem processBlocked:(aProcess interruptsDisabled). |
3694 "/ processItem processBlocked:(aProcess interruptsDisabled). |
3692 processItem prioVal:(aProcess priority). |
3695 processItem prioVal:(aProcess priority). |
3693 processItem processPrio:(self getPrioStringFor:aProcess). |
3696 processItem processPrio:(self getPrioStringFor:aProcess). |
3694 |
3697 |
3695 processItem processUsedStack:aProcess usedStackSize. |
3698 processItem processUsedStack:aProcess usedStackSize. |
3696 processItem processTotalStack:(self getTotalStackStringFor:aProcess). |
3699 processItem processTotalStack:(self getTotalStackStringFor:aProcess). |
3697 |
3700 |
3698 con := aProcess suspendedContext. |
3701 "/ must be very careful here: the process might actually be |
3699 con isNil ifTrue:[ |
3702 "/ resumed and con becomes invalid while we access it. |
3700 aProcess == Processor activeProcess ifTrue:[ |
3703 "/ this seems to be a bug in the current VM, in that it does not update |
3701 con := thisContext |
3704 "/ the returned context-ref, when the method returns, |
3702 ] |
3705 "/ AND the ref is from another process's local variable or a return value |
3703 ]. |
3706 "/ (it does, if it is ever stored into something...) |
3704 showWhere value ifTrue:[ |
3707 "/ Therefore, we must do this uninterruptably. |
3705 processItem processWhere:(self getWhereStringFor:con running:running). |
3708 [ |
3706 ]. |
3709 con := aProcess suspendedContext. |
3707 processItem processCurrentSegment:(self getCurrentSegmentStringFor:con). |
3710 con isNil ifTrue:[ |
|
3711 aProcess == Processor activeProcess ifTrue:[ |
|
3712 con := thisContext |
|
3713 ] |
|
3714 ]. |
|
3715 showWhere value ifTrue:[ |
|
3716 processItem processWhere:(self getWhereStringFor:con running:running). |
|
3717 ]. |
|
3718 processItem processCurrentSegment:(self getCurrentSegmentStringFor:con). |
|
3719 con := nil. |
|
3720 ] valueUninterruptably. |
|
3721 |
3708 processItem processSwitch:(aProcess numberOfStackBoundaryHits). |
3722 processItem processSwitch:(aProcess numberOfStackBoundaryHits). |
3709 showApplication value ifTrue:[ |
3723 showApplication value ifTrue:[ |
3710 processItem processApplication:(self getApplicationStringFor:aProcess) |
3724 processItem processApplication:(self getApplicationStringFor:aProcess) |
3711 ]. |
3725 ]. |
3712 showWindowTitle value ifTrue:[ |
3726 showWindowTitle value ifTrue:[ |
4075 ! ! |
4090 ! ! |
4076 |
4091 |
4077 !ProcessMonitorV2::ProcessItem methodsFor:'accessing'! |
4092 !ProcessMonitorV2::ProcessItem methodsFor:'accessing'! |
4078 |
4093 |
4079 groupVal |
4094 groupVal |
4080 "return the value of the instance variable 'groupVal' (automatically generated)" |
4095 "return the groupId" |
4081 |
4096 |
4082 ^ groupVal |
4097 ^ groupVal |
4083 ! |
4098 |
4084 |
4099 "Modified (comment): / 12-03-2019 / 17:58:12 / Claus Gittinger" |
4085 groupVal:something |
4100 ! |
4086 "set the value of the instance variable 'groupVal' (automatically generated)" |
4101 |
4087 |
4102 groupVal:groupIdInteger |
4088 groupVal := something. |
4103 "set the groupId" |
|
4104 |
|
4105 groupVal := groupIdInteger. |
|
4106 |
|
4107 "Modified (comment): / 12-03-2019 / 17:58:38 / Claus Gittinger" |
4089 ! |
4108 ! |
4090 |
4109 |
4091 idVal |
4110 idVal |
4092 "return the value of the instance variable 'idVal' (automatically generated)" |
4111 "return the processId" |
4093 |
4112 |
4094 ^ idVal |
4113 ^ idVal |
4095 ! |
4114 |
4096 |
4115 "Modified (comment): / 12-03-2019 / 17:58:19 / Claus Gittinger" |
4097 idVal:something |
4116 ! |
4098 "set the value of the instance variable 'idVal' (automatically generated)" |
4117 |
4099 |
4118 idVal:idInteger |
4100 idVal := something. |
4119 "set the processId" |
|
4120 |
|
4121 idVal := idInteger. |
|
4122 |
|
4123 "Modified (comment): / 12-03-2019 / 17:58:29 / Claus Gittinger" |
4101 ! |
4124 ! |
4102 |
4125 |
4103 prioVal |
4126 prioVal |
4104 "return the value of the instance variable 'prioVal' (automatically generated)" |
4127 "return the value of the instance variable 'prioVal' (automatically generated)" |
4105 |
4128 |
4172 "return the value of the instance variable 'processId' (automatically generated)" |
4195 "return the value of the instance variable 'processId' (automatically generated)" |
4173 |
4196 |
4174 ^ processId |
4197 ^ processId |
4175 ! |
4198 ! |
4176 |
4199 |
4177 processId:something |
4200 processId:processIdArg |
4178 "set the value of the instance variable 'processId' (automatically generated)" |
4201 processId := processIdArg. |
4179 |
4202 |
4180 processId := something. |
4203 "Modified (comment): / 12-03-2019 / 17:57:05 / Claus Gittinger" |
|
4204 ! |
|
4205 |
|
4206 processId:processIdArg idVal:idArg processGroup:processGroupArg groupVal:groupValArg |
|
4207 processStartTime:processStartTimeArg processName:processNameArg processState:processStateArg |
|
4208 processId := processIdArg. |
|
4209 idVal := idArg. |
|
4210 processGroup := processGroupArg. |
|
4211 groupVal := groupValArg. |
|
4212 startTimestamp := processStartTimeArg. |
|
4213 processName := processNameArg. |
|
4214 processState := processStateArg. |
|
4215 |
|
4216 "Created: / 12-03-2019 / 18:06:49 / Claus Gittinger" |
4181 ! |
4217 ! |
4182 |
4218 |
4183 processInstance |
4219 processInstance |
4184 "return the value of the instance variable 'processInstance' (automatically generated)" |
4220 "return the value of the instance variable 'processInstance' (automatically generated)" |
4185 |
4221 |