Search in sources :

Example 6 with BadConfigurationException

use of com.jopdesign.common.config.Config.BadConfigurationException in project jop by jop-devel.

the class WCETTool method initialize.

public void initialize(boolean loadLinkInfo, boolean initDFA) throws BadConfigurationException {
    if (projectConfig.saveResults()) {
        this.resultRecord = projectConfig.getResultFile();
        if (!projectConfig.appendResults()) {
            // TODO remove existing file if we do not append?
            //resultRecord.delete();
            recordMetric("problem", this.getProjectName());
            if (projectConfig.addPerformanceResults()) {
                recordMetric("date", new Date());
            }
        }
    }
    if (loadLinkInfo) {
        linkerInfo = new LinkerInfo(this);
        try {
            linkerInfo.loadLinkInfo();
        } catch (IOException e) {
            throw new BadConfigurationException("Could not load link infos", e);
        } catch (ClassNotFoundException e) {
            throw new BadConfigurationException("Could not load link infos", e);
        }
    }
    /* run dataflow analysis */
    if (doDataflowAnalysis() && initDFA) {
        topLevelLogger.info("Starting DFA analysis");
        dataflowAnalysis();
        topLevelLogger.info("DFA analysis finished");
    }
    if (!appInfo.hasCallGraph()) {
        DefaultCallgraphBuilder callGraphBuilder;
        /* build callgraph for the whole program */
        if (doDataflowAnalysis()) {
            // build the callgraph using DFA results
            callGraphBuilder = new DFACallgraphBuilder(getDfaTool(), appInfo.getCallstringLength());
        } else {
            callGraphBuilder = new DefaultCallgraphBuilder();
        }
        // we do not want natives in the callgraph
        callGraphBuilder.setSkipNatives(true);
        appInfo.buildCallGraph(callGraphBuilder);
    }
    /* build callgraph for target method */
    rebuildCallGraph();
    if (projectConfig.doPreprocess()) {
        WCETPreprocess.preprocess(appInfo);
    }
    dumpCallGraph("callgraph");
}
Also used : DFACallgraphBuilder(com.jopdesign.dfa.framework.DFACallgraphBuilder) DefaultCallgraphBuilder(com.jopdesign.common.code.DefaultCallgraphBuilder) LinkerInfo(com.jopdesign.wcet.jop.LinkerInfo) BadConfigurationException(com.jopdesign.common.config.Config.BadConfigurationException) IOException(java.io.IOException) Date(java.util.Date)

Example 7 with BadConfigurationException

use of com.jopdesign.common.config.Config.BadConfigurationException in project jop by jop-devel.

the class WCETTool method onSetupConfig.

@Override
public void onSetupConfig(AppSetup setup) throws BadConfigurationException {
    appInfo = setup.getAppInfo();
    Config config = setup.getConfig();
    projectConfig = new ProjectConfig(config);
    projectConfig.initConfig(setup.getMainMethodID());
    this.projectName = projectConfig.getProjectName();
    if (projectConfig.doGenerateReport()) {
        this.results = new Report(this, setup.getLoggerConfig());
        try {
            this.results.initVelocity();
        } catch (Exception e) {
            throw new BadConfigurationException("Error initializing Velocity: " + e, e);
        }
        this.genWCETReport = true;
    } else {
        this.genWCETReport = false;
    }
}
Also used : Report(com.jopdesign.wcet.report.Report) JOPConfig(com.jopdesign.common.processormodel.JOPConfig) IPETConfig(com.jopdesign.wcet.ipet.IPETConfig) UppAalConfig(com.jopdesign.wcet.uppaal.UppAalConfig) Config(com.jopdesign.common.config.Config) ReportConfig(com.jopdesign.wcet.report.ReportConfig) BadConfigurationException(com.jopdesign.common.config.Config.BadConfigurationException) AppInfoException(com.jopdesign.common.misc.AppInfoException) BadAnnotationException(com.jopdesign.wcet.annotations.BadAnnotationException) FileNotFoundException(java.io.FileNotFoundException) MethodNotFoundException(com.jopdesign.common.misc.MethodNotFoundException) BadConfigurationException(com.jopdesign.common.config.Config.BadConfigurationException) IOException(java.io.IOException) BadGraphException(com.jopdesign.common.misc.BadGraphException)

Example 8 with BadConfigurationException

use of com.jopdesign.common.config.Config.BadConfigurationException in project jop by jop-devel.

the class WCETTool method onSetupAppInfo.

@SuppressWarnings({ "LiteralAsArgToStringEquals" })
@Override
public void onSetupAppInfo(AppSetup setup, AppInfo appInfo) throws BadConfigurationException {
    if (projectConfig.getProcessorName().equals("allocObjs")) {
        this.processor = new ObjectAllocationModel(this);
    } else if (projectConfig.getProcessorName().equals("allocHandles")) {
        this.processor = new HandleAllocationModel(this);
    } else if (projectConfig.getProcessorName().equals("allocHeaders")) {
        this.processor = new HeaderAllocationModel(this);
    } else if (projectConfig.getProcessorName().equals("allocBlocks")) {
        this.processor = new BlockAllocationModel(this);
    } else if (projectConfig.getProcessorName().equals("jamuth")) {
        this.processor = new JamuthWCETModel(this);
    } else if (projectConfig.getProcessorName().equals("JOP")) {
        try {
            this.processor = new JOPWcetModel(this);
        } catch (IOException e) {
            throw new BadConfigurationException("Unable to initialize JopWcetModel: " + e.getMessage(), e);
        }
    } else {
        throw new BadConfigurationException("Unknown WCET model: " + projectConfig.getProcessorName());
    }
    // create output dir only after initialization is successful
    File outDir = projectConfig.getProjectDir();
    Config.checkDir(outDir, true);
}
Also used : HandleAllocationModel(com.jopdesign.wcet.allocation.HandleAllocationModel) ObjectAllocationModel(com.jopdesign.wcet.allocation.ObjectAllocationModel) HeaderAllocationModel(com.jopdesign.wcet.allocation.HeaderAllocationModel) BlockAllocationModel(com.jopdesign.wcet.allocation.BlockAllocationModel) BadConfigurationException(com.jopdesign.common.config.Config.BadConfigurationException) IOException(java.io.IOException) JOPWcetModel(com.jopdesign.wcet.jop.JOPWcetModel) File(java.io.File)

Aggregations

BadConfigurationException (com.jopdesign.common.config.Config.BadConfigurationException)8 IOException (java.io.IOException)3 DefaultCallgraphBuilder (com.jopdesign.common.code.DefaultCallgraphBuilder)2 BadConfigurationError (com.jopdesign.common.config.Config.BadConfigurationError)2 MemberID (com.jopdesign.common.type.MemberID)2 File (java.io.File)2 MethodInfo (com.jopdesign.common.MethodInfo)1 Config (com.jopdesign.common.config.Config)1 AppInfoException (com.jopdesign.common.misc.AppInfoException)1 BadGraphException (com.jopdesign.common.misc.BadGraphException)1 ClassInfoNotFoundException (com.jopdesign.common.misc.ClassInfoNotFoundException)1 MethodNotFoundException (com.jopdesign.common.misc.MethodNotFoundException)1 JOPConfig (com.jopdesign.common.processormodel.JOPConfig)1 DFACallgraphBuilder (com.jopdesign.dfa.framework.DFACallgraphBuilder)1 BlockAllocationModel (com.jopdesign.wcet.allocation.BlockAllocationModel)1 HandleAllocationModel (com.jopdesign.wcet.allocation.HandleAllocationModel)1 HeaderAllocationModel (com.jopdesign.wcet.allocation.HeaderAllocationModel)1 ObjectAllocationModel (com.jopdesign.wcet.allocation.ObjectAllocationModel)1 BadAnnotationException (com.jopdesign.wcet.annotations.BadAnnotationException)1 IPETConfig (com.jopdesign.wcet.ipet.IPETConfig)1