The quick answer is that if an atomic actor has code like:
            if (_debugging) {
                _debug(getFullName() + " consuming trigger Token" +
                        _thisTrigger);
            }
then when you listen to the actor, you will see the messages.

The slightly longer answer is that NamedObj supports DebugListeners.
Clicking "Listen to actor" adds a DebugListener to the actor and
calling _debug() sends a message to the listener.

In HyVisual, the actor/lib/Clock actor calls debug.
If you open up the SquareWave model
(at ct/demo/SquareWave/SquareWave.xml)          
and right click on the Clock actor and select
"Listen to actor"
and then run the model, you will see lots of debugging
about generated by the Clock actor.

Note that ct/lib/LevelCrossingDetector has a bug
that is tickled if debugging is turned on
The problem can be illustrated by running
the Thermostat model with "Listen to actor" turned
on for the LevelCrossingDetector in the heating state.
The model will run until it throws a NullPointerException
in the line marked below:

                if (_debugging) _debug(getFullName() + " Emitting event: " +
--->                     _inputToken.toString());

The NPE occurs because _inputToken is null.
The fix is to do something like:
               if (_debugging) {
                      _debug(getFullName() + " Emitting event: " +
                        (_inputToken != null
                                 ? _inputToken.toString()
                                 : "inputToken == null, sending "
                                   + "defaultEventValue.getToken()"));
                }


If you select 'Listen to actor' on a composite actor, then
you will see events from the Director.  Compare and contrast
this with going inside the composite actor and selecting 
Debug -> Listen to director.

-Christopher

--------

    Could someone explain how "Listen to actor" should be
    used for debugging?  I would expect it to trace the
    events into and out of a composite entity but it brings
    up an empty window for me and it stays that way.
    
    Many thanks - Jim
    
--------

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to