use of com.jopdesign.common.code.ControlFlowGraph in project jop by jop-devel.
the class Report method generateInfoPages.
/**
* Dump the project's input (callgraph,cfgs)
*
* @throws IOException
*/
public void generateInfoPages() throws IOException {
this.addStat("#classes", project.getCallGraph().getClassInfos().size());
this.addStat("#methods", project.getCallGraph().getReachableImplementationsSet(project.getTargetMethod()).size());
this.addStat("max call stack ", project.getCallGraph().getMaximalCallStack());
this.addStat("largest method size (in bytes)", project.getCallGraph().getLargestMethod().getNumberOfBytes());
this.addStat("largest method size (in words)", project.getCallGraph().getLargestMethod().getNumberOfWords());
this.addStat("total size of task (in bytes)", project.getCallGraph().getTotalSizeInBytes());
generateInputOverview();
this.addPage("details", null);
for (MethodInfo m : project.getCallGraph().getReachableImplementationsSet(project.getTargetMethod())) {
for (LineNumber ln : m.getCode().getLineNumberTable().getLineNumberTable()) {
getClassReport(m.getClassInfo()).addLinePropertyIfNull(ln.getLineNumber(), "color", "lightgreen");
}
if (logger.isDebugEnabled()) {
logger.debug("Generating report for method: " + m);
}
ControlFlowGraph flowGraph = project.getFlowGraph(m);
Map<String, Object> stats = new TreeMap<String, Object>();
stats.put("#nodes", flowGraph.vertexSet().size() - 2);
stats.put("number of words", flowGraph.getNumberOfWords());
this.addDetailedReport(m, new DetailedMethodReport(config, project, m, "CFG", stats, null, null), true);
generateDetailedReport(m);
}
for (ClassInfo c : project.getCallGraph().getClassInfos()) {
ClassReport cr = getClassReport(c);
String page = pageOf(c);
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("classreport", cr);
try {
this.generateFile("class.vm", config.getReportFile(page), ctx);
} catch (Exception e) {
logger.error(e);
}
addPage("details/" + c.getClassName(), page);
}
}
use of com.jopdesign.common.code.ControlFlowGraph in project jop by jop-devel.
the class ConstantCache method build.
public ConstantCache build() {
List<MethodInfo> methods = project.getCallGraph().getReachableImplementations(project.getTargetMethod());
for (int i = methods.size() - 1; i >= 0; i--) {
MethodInfo mi = methods.get(i);
ControlFlowGraph cfg = project.getFlowGraph(mi);
for (CFGNode n : cfg.vertexSet()) {
BasicBlock bb = n.getBasicBlock();
if (bb == null)
continue;
for (InstructionHandle ii : bb.getInstructions()) {
extractConstantAddresses(cfg, ii);
}
}
}
return this;
}
use of com.jopdesign.common.code.ControlFlowGraph 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