public void analysisBody(final IProgressMonitor monitor, final Element obj) { if (obj instanceof InstanceObject) { SystemInstance root = ((InstanceObject) obj).getSystemInstance(); monitor.beginTask(actionName, IProgressMonitor.UNKNOWN); final SOMIterator soms = new SOMIterator(root); while (soms.hasNext()) { final SystemOperationMode som = soms.nextSOM(); OsateDebug.osateDebug("[DoBoundResourceAnalysisLogic] Analyze mode " + som.getName()); // final String somName = Aadl2Util.getPrintableSOMName(som); OsateDebug.osateDebug("[DoBoundResourceAnalysisLogic] Check Processor"); errManager.infoSummaryReportOnly(root, som, "Processor Report"); checkProcessorLoads(root, som); OsateDebug.osateDebug("[DoBoundResourceAnalysisLogic] Check Virtual Processor"); errManager.infoSummaryReportOnly(root, som, "\nVirtual Processor Report"); checkVirtualProcessorLoads(root, som); OsateDebug.osateDebug("[DoBoundResourceAnalysisLogic] Check RAM/ROM"); errManager.infoSummaryReportOnly(root, som, "\nRAM/ROM Report"); checkMemoryLoads(root, som); } monitor.done(); if (root.getSystemOperationModes().size() == 1) { // Also report the results using a message dialog Dialog.showInfo("Resource Budget Statistics", errManager.getResultsMessages()); } } else Dialog.showError("Bound Resource Analysis Error", "Can only check system instances"); }
/** * check the load from connections bound to the given bus * * @param curBus Component Instance of bus * @param doBindings if true do bindings to all buses, if false do them only for EtherSwitch * @param somName String somName to be used in messages */ protected double calcBandWidthLoad(SystemInstance root, final SystemOperationMode som) { double totalBandWidth = 0.0; EList<ConnectionInstance> connections = root.getAllConnectionInstances(); EList<ConnectionInstance> budgetedConnections = new BasicEList<ConnectionInstance>(); // filters out to use only Port connections or feature group connections // it also tries to be smart about not double accounting for budgets on FG that now show for // every port instance inside. ConnectionGroupIterator cgi = new ConnectionGroupIterator(connections); while (cgi.hasNext()) { ConnectionInstance obj = cgi.next(); if (obj != null) budgetedConnections.add(obj); } for (ConnectionInstance connectionInstance : budgetedConnections) { if ((connectionInstance.getSource().getContainingComponentInstance() != null) && (!connectionInstance.getSource().getContainingComponentInstance().isActive(som))) { OsateDebug.osateDebug("[DoBoundResourceAnalysis] source not active in mode=" + som); continue; } if ((connectionInstance.getDestination().getContainingComponentInstance() != null) && (!connectionInstance .getDestination() .getContainingComponentInstance() .isActive(som))) { OsateDebug.osateDebug("[DoBoundResourceAnalysis] destination not active in mode=" + som); continue; } OsateDebug.osateDebug( "[DoBoundResourceAnalysis] source=" + connectionInstance.getSource().getContainingComponentInstance()); double budget = GetProperties.getBandWidthBudgetInKbps(connectionInstance, 0.0); double actual = calcBandwidthKBytesps(connectionInstance.getSource()); String note = ""; OsateDebug.osateDebug("[DoBoundResourceAnalysis] total=" + totalBandWidth); OsateDebug.osateDebug("[DoBoundResourceAnalysis] actual=" + actual); OsateDebug.osateDebug("[DoBoundResourceAnalysis] budget=" + budget); if (budget > 0) { if ((actual > 0) && (actual > budget)) { totalBandWidth += actual; note = "Actual bandwidth exceeds bandwidth budget. Using actual"; } else { note = "Using budget bandwidth"; totalBandWidth += budget; } } else { if (actual > 0) { totalBandWidth = totalBandWidth + actual; note = "No bandwidth budget. Using actual"; } else { note = "No bandwidth budget or actual"; } } detailedLog(connectionInstance, budget, actual, note); } OsateDebug.osateDebug("[DoBoundResourceAnalysis] res=" + totalBandWidth); return totalBandWidth; }