Search in sources :

Example 1 with IPETConfig

use of com.jopdesign.wcet.ipet.IPETConfig in project jop by jop-devel.

the class CachePersistenceAnalysis method computeMissOnceCost.

/**
	 * Analyze the cost for loading each distinct tag in the given segment at most once.
	 * This can also be used to count the number of distinct tags (given each tag the cost of 1),
	 * or the number of cache blocks for the variable block method cache (given each tag a cost
	 * equal to the number of cache blocks it needs)
	 * @param segment the segment to analyze
	 * @param accessEdges cache access edges partitioned by tag
	 * @param costModel
	 * @param useILP use integer variables (more expensive, more accurate)
	 * @param analysisKey
	 * @param wcetTool
	 * @return
	 * @throws InvalidFlowFactException 
	 * @throws LpSolveException 
	 */
protected <T> long computeMissOnceCost(Segment segment, Iterable<Entry<T, List<SuperGraphEdge>>> partition, F1<SuperGraphEdge, Long> costModel, boolean useILP, String analysisKey, WCETTool wcetTool) throws InvalidFlowFactException, LpSolveException {
    IPETConfig ipetConfig = new IPETConfig(wcetTool.getConfig());
    String problemKey = GlobalAnalysis.formatProblemName(analysisKey, segment.getEntryCFGs().toString());
    /* create an global IPET problem for the supergraph */
    IPETSolver<SuperGraphEdge> ipetSolver = GlobalAnalysis.buildIpetProblem(wcetTool, problemKey, segment, ipetConfig);
    /* add persistence constraints */
    addPersistenceSegmentConstraints(segment, partition, ipetSolver, costModel, analysisKey);
    /* Solve */
    double lpCost = ipetSolver.solve(null, useILP);
    long maxCacheCost = (long) (lpCost + 0.5);
    return maxCacheCost;
}
Also used : SuperGraphEdge(com.jopdesign.common.code.SuperGraph.SuperGraphEdge) IPETConfig(com.jopdesign.wcet.ipet.IPETConfig)

Example 2 with IPETConfig

use of com.jopdesign.wcet.ipet.IPETConfig in project jop by jop-devel.

the class ObjectCacheAnalysis method computeCacheCost.

/**
	 * Compute object cache cost for the given persistence segment
	 * @param segment the segment to consider
	 * @param usedRefs DFA result: the set of objects a reference might point to during one execution
	 *        of the segment
	 * @param costModel The object cost model to use
	 * @param usedSetOut <b>out</b> set of all symbolic objects names in the segment (pass in empty set)
	 * @return the object cache cost for the specified segment
	 * @throws InvalidFlowFactException 
	 * @throws LpSolveException 
	 */
private ObjectCacheCost computeCacheCost(Segment segment, LocalPointsToResult usedRefs, ObjectCacheCostModel costModel, HashSet<SymbolicAddress> usedSetOut) throws InvalidFlowFactException, LpSolveException {
    /* create an ILP graph for all reachable methods */
    String key = GlobalAnalysis.formatProblemName(KEY, segment.getEntryCFGs().toString());
    IPETSolver<SuperGraphEdge> ipetSolver = GlobalAnalysis.buildIpetProblem(project, key, segment, new IPETConfig(project.getConfig()));
    ObjectCacheIPETModel ocim = addObjectCacheCostEdges(segment, usedRefs, costModel, ipetSolver);
    /* solve */
    double lpCost;
    Map<SuperGraphEdge, Long> flowMap = new HashMap<SuperGraphEdge, Long>();
    lpCost = ipetSolver.solve(flowMap, true);
    long cost = (long) (lpCost + 0.5);
    return extractCost(segment, cost, flowMap, ocim.accessCostInfo, costModel, ocim.refMissEdges, ocim.blockMissEdges);
}
Also used : HashMap(java.util.HashMap) SuperGraphEdge(com.jopdesign.common.code.SuperGraph.SuperGraphEdge) CallString(com.jopdesign.common.code.CallString) IPETConfig(com.jopdesign.wcet.ipet.IPETConfig)

Example 3 with IPETConfig

use of com.jopdesign.wcet.ipet.IPETConfig in project jop by jop-devel.

the class WCETAnalysis method runWCETAnalysis.

private boolean runWCETAnalysis(MethodInfo targetMethod) {
    /* Run */
    ipetConfig = new IPETConfig(config);
    try {
        /* Analysis */
        /* some metrics and some cheap analyses for comparison and
        	 * report logging (not supported by global/uppaal at the moment) */
        runMetrics(targetMethod);
        if (wcetTool.getProjectConfig().doBlockingTimeAnalysis()) {
            runBlockingTimeAnalysis(targetMethod);
        }
        exec.info("Starting precise WCET analysis");
        /* uppaal */
        if (wcetTool.getProjectConfig().useUppaal()) {
            runUppaal(targetMethod);
        } else /* global IPET */
        {
            runGlobal(targetMethod);
        }
        exec.info("WCET analysis finished: " + wcet);
        /* report generation */
        return generateReport();
    } catch (Exception e) {
        exec.logException("analysis", e);
        return false;
    }
}
Also used : IPETConfig(com.jopdesign.wcet.ipet.IPETConfig) XmlSerializationException(com.jopdesign.wcet.uppaal.model.XmlSerializationException) DuplicateKeyException(com.jopdesign.wcet.uppaal.model.DuplicateKeyException) BadConfigurationException(com.jopdesign.common.config.Config.BadConfigurationException) InvalidFlowFactException(com.jopdesign.wcet.analysis.InvalidFlowFactException) LpSolveException(lpsolve.LpSolveException) IOException(java.io.IOException) UnsupportedCacheModelException(com.jopdesign.wcet.analysis.cache.CacheAnalysis.UnsupportedCacheModelException)

Example 4 with IPETConfig

use of com.jopdesign.wcet.ipet.IPETConfig in project jop by jop-devel.

the class WCAInvoker method initAnalysis.

public void initAnalysis(boolean useMethodCacheStrategy) {
    IPETConfig ipetConfig = new IPETConfig(wcetTool.getConfig());
    RecursiveStrategy<AnalysisContextLocal, WcetCost> strategy;
    if (useMethodCacheStrategy) {
        strategy = analyses.getMethodCacheAnalysis().createRecursiveStrategy(wcetTool, ipetConfig, cacheApproximation);
    } else {
        if (cacheApproximation.needsInterProcIPET()) {
            strategy = new GlobalAnalysis.GlobalIPETStrategy(ipetConfig);
        } else {
            strategy = new LocalAnalysis(wcetTool, ipetConfig);
        }
    }
    recursiveAnalysis = new RecursiveWcetAnalysis<AnalysisContextLocal>(wcetTool, ipetConfig, strategy);
    // Perform initial analysis
    runAnalysis(wcetTool.getCallGraph().getReversedGraph());
    updateWCEP();
}
Also used : WcetCost(com.jopdesign.wcet.analysis.WcetCost) GlobalAnalysis(com.jopdesign.wcet.analysis.GlobalAnalysis) IPETConfig(com.jopdesign.wcet.ipet.IPETConfig) AnalysisContextLocal(com.jopdesign.wcet.analysis.AnalysisContextLocal) LocalAnalysis(com.jopdesign.wcet.analysis.LocalAnalysis)

Aggregations

IPETConfig (com.jopdesign.wcet.ipet.IPETConfig)4 SuperGraphEdge (com.jopdesign.common.code.SuperGraph.SuperGraphEdge)2 CallString (com.jopdesign.common.code.CallString)1 BadConfigurationException (com.jopdesign.common.config.Config.BadConfigurationException)1 AnalysisContextLocal (com.jopdesign.wcet.analysis.AnalysisContextLocal)1 GlobalAnalysis (com.jopdesign.wcet.analysis.GlobalAnalysis)1 InvalidFlowFactException (com.jopdesign.wcet.analysis.InvalidFlowFactException)1 LocalAnalysis (com.jopdesign.wcet.analysis.LocalAnalysis)1 WcetCost (com.jopdesign.wcet.analysis.WcetCost)1 UnsupportedCacheModelException (com.jopdesign.wcet.analysis.cache.CacheAnalysis.UnsupportedCacheModelException)1 DuplicateKeyException (com.jopdesign.wcet.uppaal.model.DuplicateKeyException)1 XmlSerializationException (com.jopdesign.wcet.uppaal.model.XmlSerializationException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 LpSolveException (lpsolve.LpSolveException)1