use of EAnalysis.BinPacking.NoExpansionExpansor in project osate2 by osate.
the class Binpack method analyzeInstanceModel.
@Override
protected void analyzeInstanceModel(final IProgressMonitor monitor, final AnalysisErrorReporterManager errManager, final SystemInstance root, final SystemOperationMode som) {
try {
monitor.beginTask("Binding threads to processors in " + root.getName(), IProgressMonitor.UNKNOWN);
logInfo("Binpacker Analysis Report\n");
/*
* Verify that all the busses have a transmission time
*/
final ForAllElement addBuses = new ForAllElement(errManager) {
@Override
public void process(Element obj) {
checkBuses((ComponentInstance) obj);
}
};
addBuses.processPreOrderComponentInstance(root, ComponentCategory.BUS);
/*
* Find and report all thread and device instances that don't have a
* period specified.
*/
EList<Element> incompletethreads = new ForAllElement() {
@Override
protected boolean suchThat(Element obj) {
final ComponentCategory cat = ((ComponentInstance) obj).getCategory();
if (cat == ComponentCategory.THREAD || cat == ComponentCategory.DEVICE) {
return org.osate.pluginsupport.properties.PropertyUtils.getScaled(TimingProperties::getPeriod, (ComponentInstance) obj, TimeUnits.MS).orElse(0.0) == 0.0;
} else {
return false;
}
}
}.processPreOrderComponentInstance(root);
for (final Iterator<Element> i = incompletethreads.iterator(); i.hasNext(); ) {
final ComponentInstance o = (ComponentInstance) i.next();
logWarning((InstanceModelUtil.isThread(o) ? "Thread " : "Device ") + o.getComponentInstancePath() + " is missing period property. Using default of 1 ns");
}
/*
* Find and report all thread instances that don't have a
* compute execution time specified.
*/
incompletethreads = new ForAllElement() {
@Override
protected boolean suchThat(Element obj) {
return GetProperties.getThreadExecutioninMilliSec((ComponentInstance) obj) == 0.0;
}
}.processPreOrderComponentInstance(root, ComponentCategory.THREAD);
for (final Iterator<Element> i = incompletethreads.iterator(); i.hasNext(); ) {
final ComponentInstance o = (ComponentInstance) i.next();
logWarning("Thread " + o.getComponentInstancePath() + " is missing compute_execution_time or InstructionsPerDispatch property. Using default of 0 ns");
}
/*
* Find if all the port connections have data size
*/
final ForAllElement addThreadConnections = new ForAllElement(errManager) {
@Override
public void process(Element obj) {
if (obj instanceof ConnectionInstance) {
final ConnectionInstance connInst = (ConnectionInstance) obj;
if (connInst.getKind() == ConnectionKind.PORT_CONNECTION) {
final FeatureInstance src = (FeatureInstance) connInst.getSource();
Feature srcAP = src.getFeature();
Classifier cl = srcAP.getClassifier();
if (cl instanceof DataClassifier) {
DataClassifier srcDC = (DataClassifier) cl;
if (AadlContribUtils.getDataSize(srcDC, SizeUnits.BYTES) == 0) {
logWarning("Data size of connection source port " + src.getComponentInstancePath() + " not specified");
}
}
}
}
}
};
addThreadConnections.processPreOrderAll(root);
/* The partitionChoice is set in initializeANalysis() */
NoExpansionExpansor expansor = new NoExpansionExpansor();
LowLevelBinPacker packer = null;
if (partitionChoice == IMMEDIATE_PARTITION) {
packer = new BFCPBinPacker(expansor);
} else if (partitionChoice == DEFER_EXEC_TIME) {
packer = new DFCPBinPacker(expansor);
} else if (partitionChoice == DEFER_BANDWIDTH) {
packer = new DFBPBinPacker(expansor);
}
AssignmentResult result = binPackSystem(root, expansor, packer, errManager, som);
reportResults(som, result);
if (result.isSuccess()) {
showResults(som, root, result);
} else {
showNoResults(som);
}
} catch (InvalidModelException e) {
error(e.getElement(), e.getMessage());
}
}
Aggregations