Package ptolemy.domains.sdf.kernel
Class CachedSDFScheduler
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.sched.Scheduler
-
- ptolemy.domains.sdf.kernel.BaseSDFScheduler
-
- ptolemy.domains.sdf.kernel.SDFScheduler
-
- ptolemy.domains.sdf.kernel.CachedSDFScheduler
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
,ValueListener
public class CachedSDFScheduler extends SDFScheduler
The CachedSDFScheduler extends the SDFScheduler by caching schedules. The cached schedules are labeled by their corresponding rate signatures, with the most recently used at the beginning of the cache queue. If the rate signatures are contained in the cache keys, then the corresponding schedule in the cache is used. Therefore, we do not need to recompute the schedule again.The size of the cache in the CachedSDFScheduler is usually set by its containing director when constructing this scheduler. If the cache is full, the least recently used schedule (at the end of the cache) is discarded.
- Since:
- Ptolemy II 5.2
- Version:
- $Id$
- Author:
- Ye Zhou. Contributor: Brian K. Vogel
- See Also:
SDFScheduler
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (zhouye)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.domains.sdf.kernel.SDFScheduler
_externalRates, _firingVector, _rateVariables, constrainBufferSizes
-
Fields inherited from class ptolemy.domains.sdf.kernel.BaseSDFScheduler
VERBOSE
-
Fields inherited from class ptolemy.actor.sched.Scheduler
_DEFAULT_SCHEDULER_NAME
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description CachedSDFScheduler()
Construct a scheduler with no container(director) in the default workspace, the name of the scheduler is "Scheduler".CachedSDFScheduler(Director container, java.lang.String name, int cacheSize)
Construct a scheduler in the given container with the given name and given cache size.CachedSDFScheduler(Workspace workspace)
Construct a scheduler in the given workspace with the name "Scheduler".
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Schedule
_getSchedule()
Return the scheduling sequence.void
clearCaches()
Clear the schedule cache, cache keys and cache for external rates of this scheduler.void
constructCaches(int cacheSize)
Construct the caches of this scheduler with the given cache size.-
Methods inherited from class ptolemy.domains.sdf.kernel.SDFScheduler
_checkDynamicRateVariables, _computeMaximumFirings, _countUnfulfilledInputs, _getFiringCount, _simulateExternalInputs, _simulateInputConsumption, _solveBalanceEquations, _vectorizeFirings, clone, declareRateDependency, getExternalRates, getFiringCount, valueChanged
-
Methods inherited from class ptolemy.domains.sdf.kernel.BaseSDFScheduler
_declareDependency, _saveBufferSizes, _saveContainerRates, _saveFiringCounts
-
Methods inherited from class ptolemy.actor.sched.Scheduler
getSchedule, isValid, setContainer, setValid
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Constructor Detail
-
CachedSDFScheduler
public CachedSDFScheduler()
Construct a scheduler with no container(director) in the default workspace, the name of the scheduler is "Scheduler". The cache size is the default value of 0.
-
CachedSDFScheduler
public CachedSDFScheduler(Workspace workspace)
Construct a scheduler in the given workspace with the name "Scheduler". The cache size is the default value of 0. If the workspace argument is null, use the default workspace. The scheduler is added to the list of objects in the workspace. Increment the version number of the workspace.- Parameters:
workspace
- Object for synchronization and version tracking.
-
CachedSDFScheduler
public CachedSDFScheduler(Director container, java.lang.String name, int cacheSize) throws IllegalActionException, NameDuplicationException
Construct a scheduler in the given container with the given name and given cache size. The container argument must not be null, or a NullPointerException will be thrown. This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.- Parameters:
container
- The container.name
- The name of this attribute.cacheSize
- The cache size of this scheduler.- Throws:
IllegalActionException
- If the super class throws it.NameDuplicationException
- If the super class throws it.
-
-
Method Detail
-
clearCaches
public void clearCaches()
Clear the schedule cache, cache keys and cache for external rates of this scheduler.
-
constructCaches
public void constructCaches(int cacheSize)
Construct the caches of this scheduler with the given cache size.- Parameters:
cacheSize
- The given cache sie.
-
_getSchedule
protected Schedule _getSchedule() throws NotSchedulableException, IllegalActionException
Return the scheduling sequence. If the schedule exist in the cache (schedules are identified by the rate signatures of ports), then return the corresponding schedule in the cache. Otherwise, compute the schedule and return it.- Overrides:
_getSchedule
in classSDFScheduler
- Returns:
- A schedule of the deeply contained opaque entities in the firing order.
- Throws:
NotSchedulableException
- If the super class throws it.IllegalActionException
- If the super class throws it.- See Also:
CompositeEntity.deepEntityList()
-
-