Class ExecutionTime

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class ExecutionTime
    extends LimitedFiringSource
    Read the input token, if there is one, execute an (uninteresting) computation to consume a specified amount of real time or to execute it a fixed number of times, and produce on the output the actual execution time (in milliseconds). Unlike the Sleep actor, which suspends the calling thread for the specified amount of time, this actor performs a computation during the specified amount of time, thus consuming compute resources. If realTime is true, then the number of computations it performs is not fixed, but rather depends on what the thread scheduler does. If it is false, then the amount of computation done is fixed. The default is false.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    Sleep
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Yellow (eal)
    • Field Detail

      • executionTime

        public Parameter executionTime
        The amount of time to consume. This is either in milliseconds, if the realTime parameter is set to true, or in the number of iterations of a fixed computation, if the realTime parameter is set to false. This is a long that defaults to 1000L.
      • granularity

        public Parameter granularity
        The granularity of the computation. This parameter specifies the number of additions performed in each invocation of the (uninteresting) computation. This is a long, which defaults to 400000, which yields a computation time granularity of approximately 1msec on a MacBook Pro.
      • realTime

        public Parameter realTime
        If true, then the executionTime parameter is interpreted as milliseconds. If it is false (the default), then the executionTime parameter is interpreted to specify the number of cycles of a fixed computation. Use false to specify a fixed computational load, and use true to specify an amount of real time to consume. When this is true, if the thread executing the fire() method is preempted during its run, then less computation is done.