use of org.osate.result.AnalysisResult in project osate2 by osate.
the class FlowLatencyAnalysisSwitch method invoke.
/**
* Invoke the analysis on all ETEF owned by the given component instance and return Result collection
*
* @param ci The component instance that owns the end to end flow instances
* @param som The mode to run the analysis in. If null then run all SOMs
* @param asynchronousSystem Whether the system is treated as asynchronous
* @param majorFrameDelay Whether partition output is performed at a major frame (as opposed to the partition end)
* @param worstCaseDeadline Use deadline based processing (as opposed to max compute execution time)
* @param bestCaseEmptyQueue Assume empty queue (instead of full)
* @param disableQueuingLatency <code>true</code> if queuing latency should always be reported as zero
* @return A populated report in AnalysisResult format.
*
* @since org.osate.analysis.flows 3.0
*/
public AnalysisResult invoke(ComponentInstance ci, SystemOperationMode som, boolean asynchronousSystem, boolean majorFrameDelay, boolean worstCaseDeadline, boolean bestCaseEmptyQueue, boolean disableQueuingLatency) {
SystemInstance root = ci.getSystemInstance();
if (som == null) {
if (root.getSystemOperationModes().isEmpty() || root.getSystemOperationModes().get(0).getCurrentModes().isEmpty()) {
// no SOM
invokeOnSOM(ci, root.getSystemOperationModes().get(0), asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
} else {
// we need to run it for every SOM
for (SystemOperationMode eachsom : root.getSystemOperationModes()) {
root.setCurrentSystemOperationMode(eachsom);
invokeOnSOM(ci, eachsom, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
root.clearCurrentSystemOperationMode();
}
}
} else {
invokeOnSOM(ci, som, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
}
// Issue 1148
fillInQueuingTimes(ci.getSystemInstance());
final List<Result> finalizedResults = report.finalizeAllEntries();
return FlowLatencyUtil.recordAsAnalysisResult(finalizedResults, ci, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
}
use of org.osate.result.AnalysisResult in project osate2 by osate.
the class FlowLatencyUtil method recordAsAnalysisResult.
/**
* @since org.osate.analysis.flows 3.0
*/
public static AnalysisResult recordAsAnalysisResult(Collection<Result> results, EObject root, boolean asynchronousSystem, boolean majorFrameDelay, boolean worstCaseDeadline, boolean bestCaseEmptyQueue, boolean disableQueuingLatency) {
AnalysisResult latencyResults = createLatencyAnalysisResult(root, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
if (!results.isEmpty()) {
latencyResults.getResults().addAll(results);
} else {
Result err = ResultUtil.createErrorResult("No latency analysis result", root);
latencyResults.getResults().add(err);
}
return latencyResults;
}
use of org.osate.result.AnalysisResult in project osate2 by osate.
the class LatencyCSVReport method getReportContent.
private static StringBuffer getReportContent(AnalysisResult ar) {
StringBuffer report = new StringBuffer();
String reportheader = "Latency analysis with preference settings: " + FlowLatencyUtil.getParametersAsDescriptions(ar);
report.append(reportheader + System.lineSeparator() + System.lineSeparator());
for (Result result : ar.getResults()) {
String flowname = ((InstanceObject) result.getModelElement()).getComponentInstancePath();
SystemInstance si = ((InstanceObject) result.getModelElement()).getSystemInstance();
String systemName = si.getComponentClassifier().getName();
String inMode = ResultUtil.getString(result, 0);
String analysisheader = "\"Latency results for end-to-end flow '" + flowname + "' of system '" + systemName + "' " + inMode + "\"";
report.append(analysisheader + System.lineSeparator() + System.lineSeparator());
report.append("Result,Min Specified,Min Actual,Min Method,Max Specified,Max Actual,Max Method,Comments" + System.lineSeparator());
for (Result contributor : result.getSubResults()) {
for (Result subc : contributor.getSubResults()) {
addContributor(report, subc, true);
}
addContributor(report, contributor, false);
}
report.append("Latency Total," + ResultUtil.getReal(result, 3) + "ms," + ResultUtil.getReal(result, 1) + "ms,," + ResultUtil.getReal(result, 4) + "ms," + ResultUtil.getReal(result, 2) + "ms" + System.lineSeparator());
report.append("Specified End To End Latency,," + ResultUtil.getReal(result, 5) + "ms,,," + ResultUtil.getReal(result, 6) + "ms" + System.lineSeparator());
report.append("End to end Latency Summary" + System.lineSeparator());
for (Diagnostic dia : result.getDiagnostics()) {
report.append(dia.getDiagnosticType() + "," + dia.getMessage() + System.lineSeparator());
}
report.append(System.lineSeparator() + System.lineSeparator() + System.lineSeparator());
}
return report;
}
use of org.osate.result.AnalysisResult in project osate2 by osate.
the class LatencyExcelReport method generateExcelReport.
public static void generateExcelReport(AnalysisResult latres) {
IFile file = getExcelFile(latres);
try {
if (file.exists()) {
file.delete(true, null);
}
if (!latres.getResults().isEmpty()) {
AadlUtil.makeSureFoldersExist(file.getFullPath());
String reportHeader = "Latency analysis with preference settings: " + FlowLatencyUtil.getParametersAsDescriptions(latres);
WorkbookSettings wbSettings = new WorkbookSettings();
wbSettings.setLocale(new Locale("en", "EN"));
wbSettings.setCellValidationDisabled(false);
wbSettings.setRationalization(false);
WritableWorkbook workbook = Workbook.createWorkbook(file.getLocation().toFile(), wbSettings);
int sheetNumber = 0, i = 1;
for (Result result : latres.getResults()) {
InstanceObject instanceObject = (InstanceObject) result.getModelElement();
String flowName = instanceObject.getComponentInstancePath();
String systemName = instanceObject.getSystemInstance().getComponentClassifier().getName();
String inMode = ResultUtil.getString(result, 0);
String sheetName;
if (inMode.isEmpty()) {
sheetName = flowName;
} else {
sheetName = flowName + " in mode " + inMode;
}
// adjust the name to keep worksheet name unique
if (sheetName != null && sheetName.length() > 31) {
String s = String.valueOf(i++);
sheetName = sheetName.substring(0, 31 - s.length()) + s;
}
WritableSheet sheet = workbook.createSheet(sheetName, sheetNumber);
sheet.addCell(new Label(0, 0, reportHeader, BOLD_FORMAT));
sheet.addCell(new Label(0, 2, "Latency results for end-to-end flow '" + flowName + "' of system '" + systemName + "'" + inMode, BOLD_FORMAT));
sheet.addCell(new Label(0, 4, "Result", BOLD_FORMAT));
sheet.addCell(new Label(1, 4, "Min Specified", BOLD_FORMAT));
sheet.addCell(new Label(2, 4, "Min Actual", BOLD_FORMAT));
sheet.addCell(new Label(3, 4, "Min Method", BOLD_FORMAT));
sheet.addCell(new Label(4, 4, "Max Specified", BOLD_FORMAT));
sheet.addCell(new Label(5, 4, "Max Actual", BOLD_FORMAT));
sheet.addCell(new Label(6, 4, "Max Method", BOLD_FORMAT));
sheet.addCell(new Label(7, 4, "Comments", BOLD_FORMAT));
int row = 5;
for (Result contributor : result.getSubResults()) {
for (Result subc : contributor.getSubResults()) {
addContributor(sheet, row, subc, true);
row++;
}
addContributor(sheet, row, contributor, false);
row++;
}
sheet.addCell(new Label(0, row, "Latency Total"));
sheet.addCell(new Label(1, row, ResultUtil.getReal(result, 3) + "ms"));
sheet.addCell(new Label(2, row, ResultUtil.getReal(result, 1) + "ms"));
sheet.addCell(new Label(4, row, ResultUtil.getReal(result, 4) + "ms"));
sheet.addCell(new Label(5, row, ResultUtil.getReal(result, 2) + "ms"));
row++;
sheet.addCell(new Label(0, row, "Specified End To End Latency"));
sheet.addCell(new Label(2, row, ResultUtil.getReal(result, 5) + "ms"));
sheet.addCell(new Label(5, row, ResultUtil.getReal(result, 6) + "ms"));
row++;
sheet.addCell(new Label(0, row, "End To End Latency Summary", BOLD_FORMAT));
row++;
for (Diagnostic dia : result.getDiagnostics()) {
sheet.addCell(new Label(0, row, dia.getDiagnosticType().toString(), getCellFormat(dia)));
sheet.addCell(new Label(1, row, dia.getMessage()));
row++;
}
sheetNumber++;
}
workbook.write();
workbook.close();
file.refreshLocal(IResource.DEPTH_INFINITE, null);
}
} catch (CoreException e) {
StatusManager.getManager().handle(e, FlowanalysisPlugin.getDefault().getBundle().getSymbolicName());
} catch (IOException | WriteException e) {
String pluginId = FlowanalysisPlugin.getDefault().getBundle().getSymbolicName();
IStatus status = new Status(IStatus.ERROR, pluginId, e.getMessage(), e);
StatusManager.getManager().handle(status);
}
}
use of org.osate.result.AnalysisResult in project osate2 by osate.
the class NewBusLoadAnalysis method analyzeBody.
private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element obj) {
if (obj instanceof InstanceObject) {
final SystemInstance root = ((InstanceObject) obj).getSystemInstance();
final AnalysisResult analysisResult = ResultUtil.createAnalysisResult("Bus Load", root);
analysisResult.setResultType(ResultType.SUCCESS);
analysisResult.setMessage("Bus load analysis of " + root.getFullName());
final SOMIterator soms = new SOMIterator(root);
while (soms.hasNext()) {
final SystemOperationMode som = soms.nextSOM();
final Result somResult = ResultUtil.createResult(Aadl2Util.isPrintableSOMName(som) ? Aadl2Util.getPrintableSOMMembers(som) : "", som, ResultType.SUCCESS);
analysisResult.getResults().add(somResult);
final BusLoadModel busLoadModel = BusLoadModelBuilder.buildModel(root, som);
analyzeBusLoadModel(busLoadModel, somResult, monitor);
}
monitor.done();
return analysisResult;
} else {
Dialog.showError("Bound Bus Bandwidth Analysis Error", "Can only check system instances");
return null;
}
}
Aggregations