At 08:22 PM 2/21/2003 -0800, Edward A Lee wrote:

At 12:22 PM 2/21/2003 -0800, Jim Kleckner wrote:
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.

Actors can optionally issue debug messages, typically using code like the following:

    if (_debugging) {
        _debug( message here );
    }

However, most actors don't, so listening to a random
actor isn't that useful...

It would be better if, at a minimum, the base classes
used code like this to report invocation of the key
action methods (prefire(), fire(), postfire()).

I have modified the base classes so that they now do this reporting. However, most actors need two small changes:

1) The fire() method should call super.fire(), if it
   doesn't already (it does for some).

2) The prefire() method should do something like this:

    public boolean prefire() throws IllegalActionException {
        if (!input.hasToken(0, _numberOfInputs)) {
            if (_debugging) {
                _debug("Called prefire(), which returns false.");
            }
            return false;
        } else {
            return super.prefire();
        }
    }

This was modified from the following:

    public boolean prefire() throws IllegalActionException {
        if (!input.hasToken(0, _numberOfInputs)) return false;
        else return super.prefire();
    }

I have made these changes for all the actors in domains/sdf/lib.
Christopher:  Do you think you could make the changes in actor/lib
and domains/de/lib?

Not a high priority, but it would be nice to do at some point...

Edward



------------
Edward A. Lee, Professor
518 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0455, fax: 510-642-2739
[EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal


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

Reply via email to