use of com.jopdesign.wcet.analysis.GlobalAnalysis in project jop by jop-devel.
the class WCETAnalysis method runBlockingTimeAnalysis.
private void runBlockingTimeAnalysis(MethodInfo targetMethod) throws InvalidFlowFactException, LpSolveException, UnsupportedCacheModelException {
GlobalAnalysis an = new GlobalAnalysis(wcetTool, ipetConfig);
CacheCostCalculationMethod requestedCacheApprox = IPETConfig.getRequestedCacheApprox(config);
/* Find all synchronized segments */
Segment target = Segment.methodSegment(targetMethod, CallString.EMPTY, wcetTool, wcetTool.getCallstringLength(), wcetTool);
ArrayList<SynchronizedBlockResult> sBlocks = new ArrayList<SynchronizedBlockResult>();
for (ContextCFG ccfg : target.getCallGraphNodes()) {
for (CFGNode cfgNode : ccfg.getCfg().vertexSet()) {
if (cfgNode.getBasicBlock() == null)
continue;
for (InstructionHandle ih : cfgNode.getBasicBlock().getInstructions()) {
if (ih.getInstruction() instanceof MONITORENTER) {
/* compute synchronized block WCET */
Segment synchronizedSegment = Segment.synchronizedSegment(ccfg, cfgNode, ih, wcetTool, wcetTool.getCallstringLength(), wcetTool);
wcet = an.computeWCET(targetMethod.getShortName(), synchronizedSegment, requestedCacheApprox);
sBlocks.add(new SynchronizedBlockResult(sBlocks.size(), synchronizedSegment, cfgNode, ih, wcet));
}
}
}
}
/* check nested synchronized blocks */
for (SynchronizedBlockResult sBlock : sBlocks) {
for (SynchronizedBlockResult otherBlock : sBlocks) {
if (sBlock == otherBlock)
continue;
for (SuperGraphEdge entryEdge : otherBlock.synchronizedSegment.getEntryEdges()) {
if (sBlock.synchronizedSegment.includesEdge(entryEdge)) {
sBlock.nested.add(otherBlock);
break;
}
}
}
}
System.out.println("=== Synchronized Blocks ===");
for (SynchronizedBlockResult sBlock : sBlocks) {
sBlock.dump(System.out);
}
}
use of com.jopdesign.wcet.analysis.GlobalAnalysis in project jop by jop-devel.
the class WCETAnalysis method runGlobal.
private void runGlobal(MethodInfo targetMethod) throws InvalidFlowFactException, LpSolveException, UnsupportedCacheModelException {
CacheCostCalculationMethod requestedCacheApprox = IPETConfig.getRequestedCacheApprox(config);
GlobalAnalysis an = new GlobalAnalysis(wcetTool, ipetConfig);
Segment target = Segment.methodSegment(targetMethod, CallString.EMPTY, wcetTool, wcetTool.getCallstringLength(), wcetTool);
/* Run global analysis */
// for(CacheCostCalculationMethod cacheApprox : CacheCostCalculationMethod.values()) {
LpSolveWrapper.resetSolverTime();
long start = System.nanoTime();
wcet = an.computeWCET(targetMethod.getShortName(), target, requestedCacheApprox);
long stop = System.nanoTime();
report(wcet, start, stop, LpSolveWrapper.getSolverTime());
}
Aggregations