Search in sources :

Example 1 with AppSetup

use of com.jopdesign.common.AppSetup in project jop by jop-devel.

the class ExampleTool method main.

public static void main(String[] args) {
    // setup some defaults, initialize without any per-program defaults
    AppSetup setup = new AppSetup();
    setup.setUsageInfo("example", "This is an example application just to show off.");
    setup.setVersionInfo("The version of this whole application is 0.1");
    // We do not load an (optional) config file automatically, user has to specify it explicitly
    // using '@config.props' to avoid unintentional misconfiguration
    // setup.setConfigFilename("example.properties");
    ExampleTool example = new ExampleTool();
    setup.registerTool("example", example);
    setup.initAndLoad(args, true, true, true);
    example.doSomething(setup.getConfig());
    // write results
    setup.writeClasses();
}
Also used : AppSetup(com.jopdesign.common.AppSetup)

Example 2 with AppSetup

use of com.jopdesign.common.AppSetup in project jop by jop-devel.

the class TypeGraphTool method main.

public static void main(String[] args) {
    // setup some defaults, initialize without any per-program defaults
    AppSetup setup = new AppSetup();
    setup.setUsageInfo("typegraph", "This is tool to examine the type graph.");
    setup.setVersionInfo("The version of this whole application is 0.1");
    // set the name of the (optional) user-provided config file
    setup.setConfigFilename("typegraph.properties");
    TypeGraphTool typeGraph = new TypeGraphTool();
    setup.registerTool("typegraph", typeGraph);
    AppInfo appInfo = setup.initAndLoad(args, false, true, true);
    typeGraph.run(setup.getConfig());
}
Also used : AppSetup(com.jopdesign.common.AppSetup) AppInfo(com.jopdesign.common.AppInfo)

Example 3 with AppSetup

use of com.jopdesign.common.AppSetup in project jop by jop-devel.

the class SuperGraphTest method main.

public static void main(String[] args) {
    TestFramework testFramework = new TestFramework();
    AppSetup setup = testFramework.setupAppSetup("java/tools/test/test/cg1.zip", null);
    AppInfo appInfo = testFramework.setupAppInfo("wcet.devel.CallGraph1.run", true);
    SuperGraphTest testInst = new SuperGraphTest();
    testInst.appInfo = appInfo;
    MethodInfo mainMethod = appInfo.getMainMethod();
    SuperGraph sg0 = new SuperGraph(testInst, testInst.getFlowGraph(mainMethod), 0);
    try {
        testInst.getFlowGraph(mainMethod).exportDOT(new File("/tmp/cg1-run.dot"));
        sg0.exportDOT(new File("/tmp/cg1-super0.dot"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    SuperGraph sg2 = new SuperGraph(testInst, testInst.getFlowGraph(mainMethod), 2);
    try {
        FileWriter fw = new FileWriter("/tmp/cg1-super2.dot");
        sg2.exportDOT(new File("/tmp/cg1-super2.dot"));
        fw.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : TestFramework(com.jopdesign.common.TestFramework) FileWriter(java.io.FileWriter) AppSetup(com.jopdesign.common.AppSetup) MethodInfo(com.jopdesign.common.MethodInfo) IOException(java.io.IOException) File(java.io.File) AppInfo(com.jopdesign.common.AppInfo)

Example 4 with AppSetup

use of com.jopdesign.common.AppSetup in project jop by jop-devel.

the class JCopter method main.

public static void main(String[] args) {
    // setup some defaults
    AppSetup setup = new AppSetup();
    setup.setUsageInfo("jcopter", "A WCET driven Java bytecode optimizer.");
    setup.setVersionInfo(VERSION);
    // We do not load a config file automatically, user has to specify it explicitly to avoid
    // unintentional misconfiguration
    // setup.setConfigFilename(CONFIG_FILE_NAME);
    DFATool dfaTool = new DFATool();
    WCETTool wcetTool = new WCETTool();
    JCopter jcopter = new JCopter();
    wcetTool.setAvailableOptions(false, true, false, false);
    setup.registerTool("dfa", dfaTool, true, false);
    setup.registerTool("wca", wcetTool);
    setup.registerTool("jcopter", jcopter);
    setup.addSourceLineOptions(true);
    setup.initAndLoad(args, true, true, true);
    if (setup.useTool("dfa")) {
        wcetTool.setDfaTool(dfaTool);
        jcopter.setDfaTool(dfaTool);
    }
    jcopter.setWcetTool(wcetTool);
    wcetTool.getEventHandler().setIgnoreMissingLoopBounds(!jcopter.useWCA());
    // run optimizations
    jcopter.optimize();
    // write results
    setup.writeClasses();
}
Also used : DFATool(com.jopdesign.dfa.DFATool) AppSetup(com.jopdesign.common.AppSetup) WCETTool(com.jopdesign.wcet.WCETTool)

Example 5 with AppSetup

use of com.jopdesign.common.AppSetup in project jop by jop-devel.

the class WCETAnalysis method main.

public static void main(String[] args) {
    // We set a different output path for this tool if invoked by cmdline
    // Note that WCETTool could also override defaults, but we do not want to change the
    // default value of outdir if WCETTool is invoked from another tool
    Properties defaultProps = new Properties();
    defaultProps.put("outdir", "java/target/wcet/${projectname}");
    AppSetup setup = new AppSetup(defaultProps, false);
    setup.setVersionInfo("1.0.1");
    // We do not load a config file automatically, user has to specify it explicitly to avoid
    // unintentional misconfiguration
    // setup.setConfigFilename(CONFIG_FILE_NAME);
    setup.setUsageInfo("WCETAnalysis", "WCET Analysis tool");
    WCETTool wcetTool = new WCETTool();
    DFATool dfaTool = new DFATool();
    setup.registerTool("dfa", dfaTool, true, false);
    setup.registerTool("wcet", wcetTool);
    setup.addSourceLineOptions(false);
    setup.initAndLoad(args, true, false, false);
    if (setup.useTool("dfa")) {
        wcetTool.setDfaTool(dfaTool);
    }
    ExecHelper exec = new ExecHelper(setup.getConfig(), Logger.getLogger(WCETTool.LOG_WCET + ".WCETAnalysis"));
    exec.dumpConfig();
    /* Load config */
    exec.checkLibs();
    /* check environment */
    WCETAnalysis inst = new WCETAnalysis(wcetTool, exec);
    try {
        inst.run();
        exec.info("Worst Case Analysis finished");
        exec.info("Cumulative LP/ILP solver time: " + LpSolveWrapper.getTotalSolverTime());
        exec.info("Cumulative WCET Calculation time: " + inst.totalWCETCalculationTime);
    } catch (Exception e) {
        exec.bail("Worst Case Analysis failed: " + e);
    }
}
Also used : DFATool(com.jopdesign.dfa.DFATool) AppSetup(com.jopdesign.common.AppSetup) Properties(java.util.Properties) 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)

Aggregations

AppSetup (com.jopdesign.common.AppSetup)10 AppInfo (com.jopdesign.common.AppInfo)7 IOException (java.io.IOException)4 MethodInfo (com.jopdesign.common.MethodInfo)3 TestFramework (com.jopdesign.common.TestFramework)3 DFATool (com.jopdesign.dfa.DFATool)3 File (java.io.File)3 ClassInfo (com.jopdesign.common.ClassInfo)2 FileWriter (java.io.FileWriter)2 Properties (java.util.Properties)2 MethodCode (com.jopdesign.common.MethodCode)1 CallGraph (com.jopdesign.common.code.CallGraph)1 CFGNode (com.jopdesign.common.code.ControlFlowGraph.CFGNode)1 InvokeNode (com.jopdesign.common.code.ControlFlowGraph.InvokeNode)1 SuperGraph (com.jopdesign.common.code.SuperGraph)1 ContextCFG (com.jopdesign.common.code.SuperGraph.ContextCFG)1 SuperEdge (com.jopdesign.common.code.SuperGraph.SuperEdge)1 SuperGraphEdge (com.jopdesign.common.code.SuperGraph.SuperGraphEdge)1 SuperGraphNode (com.jopdesign.common.code.SuperGraph.SuperGraphNode)1 SuperInvokeEdge (com.jopdesign.common.code.SuperGraph.SuperInvokeEdge)1