use of org.jgrapht.traverse.TopologicalOrderIterator in project jop by jop-devel.
the class WCAInvoker method runAnalysis.
// /////////////////////////////////////////////////////////////////////////////
// Private methods
// /////////////////////////////////////////////////////////////////////////////
private Set<MethodInfo> runAnalysis(DirectedGraph<ExecutionContext, ContextEdge> reversed) {
// Phew. The WCA only runs on acyclic callgraphs, we can therefore assume the
// reversed graph to be a DAG
TopologicalOrderIterator<ExecutionContext, ContextEdge> topOrder = new TopologicalOrderIterator<ExecutionContext, ContextEdge>(reversed);
Set<MethodInfo> changed = new LinkedHashSet<MethodInfo>();
while (topOrder.hasNext()) {
ExecutionContext node = topOrder.next();
// At times like this I really wish Java would have type aliases ..
RecursiveWcetAnalysis<AnalysisContextLocal>.LocalWCETSolution sol = recursiveAnalysis.computeSolution(node.getMethodInfo(), new AnalysisContextLocal(cacheApproximation, node.getCallString()));
wcaNodeFlow.put(node, sol.getNodeFlowVirtual());
// TODO some logging would be nice, keep target-method WCET for comparison of speedup
if (node.getMethodInfo().equals(wcetTool.getTargetMethod())) {
lastWCET = sol.getCost().getCost();
logger.info("WCET: " + lastWCET);
}
changed.add(node.getMethodInfo());
}
return changed;
}
Aggregations