Search in sources :

Example 1 with HardwareNode

use of EAnalysis.BinPacking.HardwareNode in project osate2 by osate.

the class Binpack method reportResults.

public void reportResults(SystemOperationMode som, final AssignmentResult result) {
    final Map threadsToProc = getThreadBindings(result.getProblem().getHardwareGraph());
    logInfo("\nBinpacking results" + (!som.getName().equalsIgnoreCase("No Modes") ? " for SOM " + som.getName() : "") + ": " + (result.isSuccess() ? "Success" : "FAILED"));
    for (final Iterator i = result.getProblem().getHardwareGraph().iterator(); i.hasNext(); ) {
        final HardwareNode hn = (HardwareNode) i.next();
        final ComponentInstance proc = (ComponentInstance) hn.getSemanticObject();
        double load = hn.getCyclesPerSecond() - hn.getAvailableCapacity();
        load /= hn.getCyclesPerSecond();
        load *= 100.0;
        long longLoad = (long) Math.ceil(load);
        double overload = (hn.getCyclesPerSecond() - hn.getAvailableCapacity()) - (hn.getCyclesPerSecond());
        overload /= hn.getCyclesPerSecond();
        overload *= 100.0;
        long longOverload = (long) Math.ceil(overload);
        long available = longOverload * -1;
        logInfo("Processor " + proc.getInstanceObjectPath() + " (" + hn.getCyclesPerSecond() / 1000000 + " MIPS) Load: " + Long.toString(longLoad) + "%" + " Available: " + Long.toString(available) + "%");
    }
    logInfo("\nThread to Processor Bindings");
    for (Iterator iter = threadsToProc.keySet().iterator(); iter.hasNext(); ) {
        final ComponentInstance thread = (ComponentInstance) iter.next();
        final ComponentInstance proc = (ComponentInstance) threadsToProc.get(thread);
        double threadMips = GetProperties.getThreadExecutioninMIPS(thread);
        double cpumips = GetProperties.getMIPSCapacityInMIPS(proc, 0);
        logInfo("Thread " + thread.getInstanceObjectPath() + " ==> Processor " + proc.getInstanceObjectPath() + (cpumips > 0 ? (" Utilization " + threadMips / cpumips * 100 + "%") : " No CPU capacity"));
    }
}
Also used : Iterator(java.util.Iterator) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) HardwareNode(EAnalysis.BinPacking.HardwareNode) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with HardwareNode

use of EAnalysis.BinPacking.HardwareNode in project osate2 by osate.

the class Binpack method getThreadBindings.

private Map getThreadBindings(final Set hardware) {
    final Map threadsToProc = new HashMap();
    for (Iterator iter = hardware.iterator(); iter.hasNext(); ) {
        HardwareNode n = (HardwareNode) iter.next();
        for (Iterator taskSet = n.getTaskSet().iterator(); taskSet.hasNext(); ) {
            SoftwareNode m = (SoftwareNode) taskSet.next();
            if (m instanceof CompositeSoftNode) {
                final Set set = ((CompositeSoftNode) m).getBasicComponents();
                for (Iterator software = set.iterator(); software.hasNext(); ) {
                    final SoftwareNode sn = (SoftwareNode) software.next();
                    threadsToProc.put(sn.getSemanticObject(), n.getSemanticObject());
                }
            } else {
                if (!(m instanceof Message)) {
                    threadsToProc.put(m.getSemanticObject(), n.getSemanticObject());
                }
            }
        }
    }
    return threadsToProc;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) Message(EAnalysis.BinPacking.Message) HashMap(java.util.HashMap) SoftwareNode(EAnalysis.BinPacking.SoftwareNode) CompositeSoftNode(EAnalysis.BinPacking.CompositeSoftNode) Iterator(java.util.Iterator) HardwareNode(EAnalysis.BinPacking.HardwareNode) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with HardwareNode

use of EAnalysis.BinPacking.HardwareNode in project osate2 by osate.

the class PackingSuccessfulDialog method availableCycles.

public static boolean availableCycles(Set hwGraph) {
    double available = 0.0;
    for (final Iterator i = hwGraph.iterator(); i.hasNext(); ) {
        final HardwareNode hn = (HardwareNode) i.next();
        available += hn.getAvailableCapacity();
    }
    return available >= 0.05;
}
Also used : Iterator(java.util.Iterator) HardwareNode(EAnalysis.BinPacking.HardwareNode)

Example 4 with HardwareNode

use of EAnalysis.BinPacking.HardwareNode in project osate2 by osate.

the class PackingSuccessfulDialog method buildProcArea.

private void buildProcArea(final Composite parent) {
    parent.setLayout(new FillLayout());
    final Table table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLinesVisible(false);
    final TableColumn threadsCol = new TableColumn(table, SWT.RIGHT, 0);
    threadsCol.setText("Processor");
    threadsCol.setWidth(150);
    threadsCol.setResizable(true);
    final TableColumn loadCol = new TableColumn(table, SWT.LEFT, 1);
    loadCol.setText("% Load");
    loadCol.setWidth(150);
    loadCol.setResizable(true);
    final TableColumn procsCol = new TableColumn(table, SWT.LEFT, 2);
    procsCol.setText("% Available/Overload");
    procsCol.setWidth(150);
    procsCol.setResizable(true);
    for (final Iterator i = hwGraph.iterator(); i.hasNext(); ) {
        final HardwareNode hn = (HardwareNode) i.next();
        final ComponentInstance proc = (ComponentInstance) hn.getSemanticObject();
        final TableItem row = new TableItem(table, SWT.NONE);
        double load = hn.getCyclesPerSecond() - hn.getAvailableCapacity();
        load /= hn.getCyclesPerSecond();
        load *= 100.0;
        long longLoad = (long) Math.ceil(load);
        double overload = (hn.getCyclesPerSecond() - hn.getAvailableCapacity()) - hn.getCyclesPerSecond();
        overload /= hn.getCyclesPerSecond();
        overload *= 100.0;
        long longOverload = (long) Math.ceil(overload);
        long available = longOverload * -1;
        row.setText(new String[] { proc.getInstanceObjectPath(), Long.toString(longLoad) + "%", Long.toString(available) + "%" });
    }
}
Also used : Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem) Iterator(java.util.Iterator) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) HardwareNode(EAnalysis.BinPacking.HardwareNode) FillLayout(org.eclipse.swt.layout.FillLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Aggregations

HardwareNode (EAnalysis.BinPacking.HardwareNode)4 Iterator (java.util.Iterator)4 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)2 CompositeSoftNode (EAnalysis.BinPacking.CompositeSoftNode)1 Message (EAnalysis.BinPacking.Message)1 SoftwareNode (EAnalysis.BinPacking.SoftwareNode)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Table (org.eclipse.swt.widgets.Table)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 TableItem (org.eclipse.swt.widgets.TableItem)1