use of com.jopdesign.common.graphutils.ProgressMeasure in project jop by jop-devel.
the class TreeAnalysis method computeProgress.
/* FIXME: filter leaf methods is really a ugly hack,
* but needs some work to play nice with uppaal eliminate-leaf-methods optimizations
*/
public void computeProgress(MethodInfo targetMethod, CallString cs) {
List<MethodInfo> reachable = project.getCallGraph().getReachableImplementations(targetMethod, cs);
Collections.reverse(reachable);
for (MethodInfo mi : reachable) {
ControlFlowGraph cfg = project.getFlowGraph(mi);
Map<CFGNode, Long> localProgress = new HashMap<CFGNode, Long>();
ProgressVisitor progressVisitor = new ProgressVisitor(maxProgress);
for (CFGNode n : cfg.vertexSet()) {
localProgress.put(n, progressVisitor.getProgress(n));
}
ProgressMeasure<CFGNode, CFGEdge> pm = new ProgressMeasure<CFGNode, ControlFlowGraph.CFGEdge>(cfg.getGraph(), cfg.getLoopColoring(), extractUBs(cfg.buildLoopBoundMap()), localProgress);
long progress = pm.getMaxProgress().get(cfg.getExit());
/* FIXME: _UGLY_ hack */
if (filterLeafMethods && cfg.isLeafMethod()) {
maxProgress.put(mi, 0L);
} else {
maxProgress.put(mi, progress);
}
relativeProgress.put(mi, pm.computeRelativeProgress());
}
System.out.println("Progress Measure (max): " + maxProgress.get(targetMethod));
}
use of com.jopdesign.common.graphutils.ProgressMeasure in project jop by jop-devel.
the class TreeAnalysis method computeWCET.
public long computeWCET(MethodInfo targetMethod) {
this.methodWCET = new HashMap<MethodInfo, Long>();
List<MethodInfo> reachable = project.getCallGraph().getReachableImplementations(targetMethod);
Collections.reverse(reachable);
for (MethodInfo mi : reachable) {
ControlFlowGraph cfg = project.getFlowGraph(mi);
Map<CFGNode, Long> localCost = new HashMap<CFGNode, Long>();
LocalCostVisitor lcv = new LocalCostVisitor(new AnalysisContextCallString(CallString.EMPTY), project);
for (CFGNode n : cfg.vertexSet()) {
localCost.put(n, lcv.computeCost(n).getCost());
}
ProgressMeasure<CFGNode, ControlFlowGraph.CFGEdge> pm = new ProgressMeasure<CFGNode, ControlFlowGraph.CFGEdge>(cfg.getGraph(), cfg.getLoopColoring(), extractUBs(cfg.buildLoopBoundMap()), localCost);
long wcet = pm.getMaxProgress().get(cfg.getExit());
methodWCET.put(mi, wcet);
}
return methodWCET.get(targetMethod);
}
Aggregations