Esempio n. 1
0
  public Analyzer(
      AnalysisSpecification spec) { // Why is this here ?? There is not ref to it in the project
    this.specification = spec;

    if (specification.getTypeOfAnalysisPerformed() != AnalysisType.ALLOCATIONS) {
      this.stackAnalyzer = new StackAnalyzer(specification.getJvmModel());
    }
  }
Esempio n. 2
0
  public void start(Class<? extends ICostComputer<ICostResult>> costComputerType)
      throws InstantiationException, IllegalAccessException, IllegalArgumentException,
          WalaException, IOException, SecurityException, InvocationTargetException,
          NoSuchMethodException {
    this.costComputer =
        costComputerType
            .getDeclaredConstructor(JVMModel.class)
            .newInstance(specification.getJvmModel());

    LinkedList<CGNode> entryCGNodes = specification.getEntryPointCGNodes();

    for (CGNode entryNode : entryCGNodes) {
      // OutputPrinter.printInfo("Starting entry node " + entryNode.getMethod().toString());
      ICostResult results = new CGNodeAnalyzer(entryNode, costComputer).analyzeNode();
      // ICostResult results = new
      // CostComputerMemory(specification.getJvmModel()).dfsVisit(entryNode);
      // Test code
      CostResultMemory memRes = (CostResultMemory) results;
      OutputPrinter.printInfo(
          "Worst case allocation for "
              + entryNode.getMethod().toString()
              + ":\t"
              + results.getCostScalar());
      for (Entry<TypeName, Integer> i : memRes.aggregatedCountByTypename.entrySet()) {
        OutputPrinter.printInfo(
            "\t TYPE_NAME\t" + i.getKey().toString() + "\tCOUNT " + i.getValue());
      }
    }
    /* This is move to the program.
    if ( specification.getTypeOfAnalysisPerformed() != AnalysisType.ALLOCATIONS) {
    	stackAnalyzer.analyze();
    }

    if ( specification.getShouldGenerateAnalysisReports() == true) {
    	ReportGenerator gen = new ReportGenerator();
    	gen.Generate(AnalysisResults.getAnalysisResults().getReportEntries());
    }*/
  }
Esempio n. 3
0
 private Analyzer() {
   this.specification = AnalysisSpecification.getAnalysisSpecification();
   this.stackAnalyzer = new StackAnalyzer(specification.getJvmModel());
 }