use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class BoundResourceAnalysis method checkMemoryLoads.
private void checkMemoryLoads(SystemInstance si, final SystemOperationMode som) {
count = 0;
ForAllElement countme = new ForAllElement() {
@Override
protected void process(Element obj) {
if (canHaveMemory(obj)) {
if (getROMCapacityInKB(obj) > 0.0 || getRAMCapacityInKB(obj) > 0.0 || getMemorySize(obj) > 0.0) {
count = count + 1;
}
}
}
};
countme.processPreOrderComponentInstance(si);
if (count > 0) {
errManager.infoSummaryReportOnly(si, null, "\nMemory Summary Report: " + Aadl2Util.getPrintableSOMName(som));
} else {
errManager.infoSummaryReportOnly(si, null, "\nMemory Summary Report: " + Aadl2Util.getPrintableSOMName(som) + "\n No Memory with Memory_Size or RAMCapacity or ROMCapacity");
}
ForAllElement mal = new ForAllElement() {
@Override
protected void process(Element obj) {
if (canHaveMemory(obj)) {
checkMemoryLoad((ComponentInstance) obj, som);
}
}
};
mal.processPreOrderComponentInstance(si);
}
use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class CheckPriorityInversion method analyzeInstanceModel.
@Override
protected void analyzeInstanceModel(final IProgressMonitor monitor, final AnalysisErrorReporterManager errManager, final SystemInstance root, final SystemOperationMode som) {
monitor.beginTask(getActionName(), IProgressMonitor.UNKNOWN);
try {
final PriorityInversion pi = new PriorityInversion(errManager);
pi.checkSystemPriorityInversion(root);
} catch (InvalidModelException e) {
error(e.getElement(), e.getMessage());
}
monitor.done();
}
use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class BoundResourceAnalysis method doMemoryLoad.
/**
* check the load from components bound to the given memory The components
* can be threads or higher level components.
*
* @param curMemory Component Instance of memory
*/
private void doMemoryLoad(ComponentInstance curMemory, final SystemOperationMode som, double Memorycapacity, EList<ComponentInstance> boundComponents, ResourceKind rk) {
double totalMemory = 0.0;
String somName = null;
String resourceName = rk.name();
boolean isROM = rk.equals(ResourceKind.ROM);
if (boundComponents.size() == 0 && Memorycapacity > 0) {
errManager.infoSummary(curMemory, somName, " No application components bound to " + curMemory.getComponentInstancePath() + " with " + resourceName + " capacity " + toStringScaled(Memorycapacity, SizeUnits.KBYTE));
return;
}
if (Memorycapacity == 0) {
errManager.errorSummary(curMemory, somName, " Memory " + curMemory.getComponentInstancePath() + " has no " + resourceName + " capacity but has bound components.");
}
logHeader("\n\nDetailed Workload Report: " + Aadl2Util.getPrintableSOMName(som) + " for memory " + curMemory.getComponentInstancePath() + " with Capacity " + toStringScaled(Memorycapacity, SizeUnits.KBYTE) + "\n\nComponent,Budget,Actual");
Set<ComponentInstance> budgeted = new HashSet<>();
for (ComponentInstance bci : boundComponents) {
String notes = "";
double totalactual = sumMemoryActualPropertyValue(bci, isROM);
double budget = isROM ? getROMBudgetInKB(bci) : getRAMBudgetInKB(bci);
double actualsize = getMemoryUseActual(bci, resourceName, SizeUnits.KBYTE);
if (actualsize > 0) {
// only compare if there were actuals
if (budget > 0 && actualsize > budget) {
notes = ",Error: " + resourceName + " subtotal exceeds budget by " + (actualsize - budget) + " KB";
} else if (actualsize < budget) {
notes = ",Warning: " + resourceName + " Subtotal under budget by " + (budget - actualsize) + " KB";
}
if (totalactual > 0 && totalactual != actualsize) {
notes = notes + ",Warning: " + resourceName + " Data_Size differs from RAM/ROMActual";
}
}
if (totalactual > 0) {
// only compare if there were actuals
if (budget > 0 && totalactual > budget) {
notes = notes + ",Error: " + resourceName + " subtotal exceeds budget by " + (totalactual - budget) + " KB";
} else if (totalactual < budget) {
notes = notes + ",Warning: " + resourceName + " Subtotal under budget by " + (budget - totalactual) + " KB";
}
}
if (totalactual == 0.0 && actualsize == 0.0) {
// we use a budget number as there are no actuals
if (budget > 0 && !budgeted.contains(bci)) {
// only add it if no children budget numbers have been added
totalMemory += budget;
detailedLog(bci, budget, budget, "No actual. Added budget to total.");
// add ancestors to budgeted list so their budget does not get added later
while ((bci = bci.getContainingComponentInstance()) != null) {
budgeted.add(bci);
}
}
} else {
if (actualsize > 0) {
detailedLog(bci, budget, actualsize, notes);
totalMemory += actualsize;
} else {
// add only the current actual; the children actual have been added before
double currentActual = isROM ? getROMActualInKB(bci) : getRAMActualInKB(bci);
detailedLog(bci, budget, currentActual, notes);
totalMemory += currentActual;
}
}
}
detailedLogTotal2(null, totalMemory, SizeUnits.KBYTE);
if (Memorycapacity == 0) {
errManager.errorSummary(curMemory, somName, " " + resourceName + curMemory.getComponentInstancePath() + " has no memory capacity specified");
}
if (totalMemory > Memorycapacity) {
errManager.errorSummary(curMemory, somName, " Total Memory " + totalMemory + " KB of bounds tasks exceeds Memory capacity " + Memorycapacity + " KB of " + curMemory.getComponentInstancePath());
} else if (totalMemory == 0.0 && Memorycapacity == 0.0) {
errManager.warningSummary(curMemory, somName, " " + resourceName + curMemory.getComponentInstancePath() + " has no capacity. Bound app's have no memory budget.");
} else {
errManager.infoSummary(curMemory, somName, " Total " + resourceName + " " + totalMemory + " KB of bound tasks within Memory capacity " + Memorycapacity + " KB of " + curMemory.getComponentInstancePath());
}
}
use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class BoundResourceAnalysis method checkVirtualProcessorLoads.
private void checkVirtualProcessorLoads(SystemInstance si, final SystemOperationMode som) {
count = 0;
ForAllElement countme = new ForAllElement() {
@Override
protected void process(Element obj) {
count = count + 1;
}
};
countme.processPreOrderComponentInstance(si, ComponentCategory.VIRTUAL_PROCESSOR);
if (count > 0) {
errManager.infoSummaryReportOnly(si, null, "\nVirtual Processor Summary Report: " + Aadl2Util.getPrintableSOMName(som));
}
ForAllElement mal = new ForAllElement() {
@Override
protected void process(Element obj) {
checkProcessorLoad((ComponentInstance) obj, som);
}
};
mal.processPreOrderComponentInstance(si, ComponentCategory.VIRTUAL_PROCESSOR);
}
use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class BusLoadAnalysis method checkBusLoads.
private void checkBusLoads(SystemInstance si, final SystemOperationMode som) {
errManager.infoSummaryReportOnly(si, null, "\nBus Summary Report: " + Aadl2Util.getPrintableSOMName(som));
ForAllElement mal = new ForAllElement() {
@Override
protected void process(final Element obj) {
final ComponentInstance ci = (ComponentInstance) obj;
final ComponentCategory cat = ci.getCategory();
if (cat == ComponentCategory.BUS) {
checkBusBandWidthLoad(ci, som);
} else if (cat == ComponentCategory.VIRTUAL_BUS) {
checkVirtualBusBandWidthLoad(ci, som);
}
}
};
mal.processPreOrderComponentInstance(si);
}
Aggregations