/** Expensive! */
  private void dumpCallGraphReachablesCSV() {
    try {
      FileWriter fw =
          new FileWriter(Project.v().getOutputDir() + File.separator + "reachables-count.csv");

      fw.write("Method,Reachables");

      for (MethodOrMethodContext momc : getReachableMethodContexts()) {
        if ("<clinit>".equals(momc.method().getName())) continue;

        Set<MethodOrMethodContext> c = new HashSet<MethodOrMethodContext>();
        c.add(momc);
        Filter filter = new Filter(noStaticInits);
        // filter on static initializers, hopefully they won't show in the stats,
        // or any calls that they make...
        ReachableMethods rm = new ReachableMethods(callGraph, c.iterator(), filter);
        rm.update();

        QueueReader<MethodOrMethodContext> edges = rm.listener();
        int reachables = 0;
        while (edges.hasNext()) {
          MethodOrMethodContext reachable = edges.next();
          if ("<clinit>".equals(reachable.method().getName())) continue;
          reachables++;
        }

        fw.write(momc + "|" + reachables + "\n");
      }

      fw.close();

    } catch (IOException e) {

    }
  }
Exemple #2
0
 public ReachableMethods getReachableMethods() {
   if (reachableMethods == null) {
     reachableMethods =
         new ReachableMethods(
             getCallGraph(), new ArrayList<MethodOrMethodContext>(getEntryPoints()));
   }
   reachableMethods.update();
   return reachableMethods;
 }
Exemple #3
0
 private void processReachables() {
   reachableMethods.update();
   while (reachablesReader.hasNext()) {
     MethodOrMethodContext m = (MethodOrMethodContext) reachablesReader.next();
     MethodPAG mpag = MethodPAG.v(pag, m.method());
     mpag.build();
     mpag.addToPAG(m.context());
   }
 }