use of com.jopdesign.wcet.analysis.RecursiveWcetAnalysis in project jop by jop-devel.
the class MethodBuilder method visitSummaryNode.
public void visitSummaryNode(ControlFlowGraph.SummaryNode n) {
RecursiveWcetAnalysis<AnalysisContextLocal> an = new RecursiveWcetAnalysis<AnalysisContextLocal>(jTrans.getProject(), new LocalAnalysis());
WcetCost cost = an.runWCETComputation("SUBGRAPH" + n.getId(), n.getSubGraph(), new AnalysisContextLocal(CacheCostCalculationMethod.ALWAYS_MISS)).getTotalCost();
SubAutomaton sumLoc = createBasicBlock(n.getId(), cost.getCost());
this.nodeTemplates.put(n, sumLoc);
}
use of com.jopdesign.wcet.analysis.RecursiveWcetAnalysis in project jop by jop-devel.
the class WCETAnalysis method runMetrics.
private void runMetrics(MethodInfo targetMethod) throws Exception {
/* generate reports later for simple_fit */
wcetTool.setGenerateWCETReport(false);
/* check whether the largest method fits into the cache */
List<MethodInfo> allMethods = wcetTool.getCallGraph().getReachableImplementations(targetMethod);
MethodInfo largestMethod = MethodCacheAnalysis.checkCache(wcetTool, allMethods);
int minWords = MiscUtils.bytesToWords(largestMethod.getCode().getNumberOfBytes());
reportMetric("min-cache-size", largestMethod.getFQMethodName(), minWords);
/* Compute cyclomatic complexity */
exec.info("Cyclomatic complexity: " + wcetTool.computeCyclomaticComplexity(targetMethod));
/* Fast, useful cache approximationx */
CacheCostCalculationMethod cacheApprox = CacheCostCalculationMethod.ALL_FIT_SIMPLE;
/* Perform a few standard analysis (MIN_CACHE_COSdT, ALWAYS_HIT, ALWAYS_MISS) without call strings */
long start, stop;
/* Tree based WCET analysis - has to be equal to ALWAYS_MISS if no flow facts are used */
{
start = System.nanoTime();
TreeAnalysis treeAna = new TreeAnalysis(wcetTool, false);
long treeWCET = treeAna.computeWCET(targetMethod);
stop = System.nanoTime();
reportMetric("progress-measure", treeAna.getMaxProgress(targetMethod));
reportSpecial("wcet.tree", WcetCost.totalCost(treeWCET), start, stop, 0.0);
}
RecursiveWcetAnalysis<AnalysisContextLocal> an = new RecursiveWcetAnalysis<AnalysisContextLocal>(wcetTool, ipetConfig, new LocalAnalysis(wcetTool, ipetConfig));
/* always miss */
start = System.nanoTime();
alwaysMissCost = an.computeCost(targetMethod, new AnalysisContextLocal(CacheCostCalculationMethod.ALWAYS_MISS));
stop = System.nanoTime();
reportSpecial("always-miss", alwaysMissCost, start, stop, LpSolveWrapper.getSolverTime());
/* always hit */
LpSolveWrapper.resetSolverTime();
start = System.nanoTime();
alwaysHitCost = an.computeCost(targetMethod, new AnalysisContextLocal(CacheCostCalculationMethod.ALWAYS_HIT));
stop = System.nanoTime();
reportSpecial("always-hit", alwaysHitCost, start, stop, LpSolveWrapper.getSolverTime());
/* simple approx */
wcetTool.setGenerateWCETReport(true);
start = System.nanoTime();
approxCost = an.computeCost(targetMethod, new AnalysisContextLocal(cacheApprox));
stop = System.nanoTime();
reportSpecial("recursive-report", approxCost, start, stop, LpSolveWrapper.getSolverTime());
wcetTool.setGenerateWCETReport(false);
}
use of com.jopdesign.wcet.analysis.RecursiveWcetAnalysis 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<AnalysisContextLocal> 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