Search in sources :

Example 1 with ProgressMeasure

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));
}
Also used : CFGNode(com.jopdesign.common.code.ControlFlowGraph.CFGNode) HashMap(java.util.HashMap) ControlFlowGraph(com.jopdesign.common.code.ControlFlowGraph) MethodInfo(com.jopdesign.common.MethodInfo) ProgressMeasure(com.jopdesign.common.graphutils.ProgressMeasure) CFGEdge(com.jopdesign.common.code.ControlFlowGraph.CFGEdge)

Example 2 with ProgressMeasure

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);
}
Also used : CFGNode(com.jopdesign.common.code.ControlFlowGraph.CFGNode) HashMap(java.util.HashMap) ProgressMeasure(com.jopdesign.common.graphutils.ProgressMeasure) ControlFlowGraph(com.jopdesign.common.code.ControlFlowGraph) MethodInfo(com.jopdesign.common.MethodInfo) CFGEdge(com.jopdesign.common.code.ControlFlowGraph.CFGEdge)

Aggregations

MethodInfo (com.jopdesign.common.MethodInfo)2 ControlFlowGraph (com.jopdesign.common.code.ControlFlowGraph)2 CFGEdge (com.jopdesign.common.code.ControlFlowGraph.CFGEdge)2 CFGNode (com.jopdesign.common.code.ControlFlowGraph.CFGNode)2 ProgressMeasure (com.jopdesign.common.graphutils.ProgressMeasure)2 HashMap (java.util.HashMap)2