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"));
}
}
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;
}
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;
}
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) + "%" });
}
}
Aggregations