예제 #1
0
 @After
 public void assureEvaluatorIsSane() {
   assertTrue(evaluator.getCurrentEnvt().isRootScope());
   assertTrue(evaluator.getCurrentEnvt().isRootStackFrame());
   assertTrue(
       "When we are at the root scope and stack frame, the accumulators should be empty as well",
       evaluator.getAccumulators().empty());
 }
예제 #2
0
파일: Profiler.java 프로젝트: stil4m/rascal
  @Override
  public void run() {
    while (running) {
      AbstractAST current = eval.getCurrentAST();
      Environment env = eval.getCurrentEnvt();
      String name = env.getName();

      if (current != null) {
        ISourceLocation stat = current.getLocation();
        if (stat != null) {
          Count currentCount = ast.get(stat);
          if (currentCount == null) {
            ast.put(stat, new Count());
            names.put(stat, name);
          } else {
            currentCount.increment();
          }
        }
        while (env.getParent() != null && !env.getParent().isRootScope()) {
          env = env.getParent();
        }
        if (env != null) {
          Count currentCount = frame.get(env.getLocation());
          if (currentCount == null) {
            frame.put(env.getLocation(), new Count());
            names.put(env.getLocation(), env.getName());
          } else {
            currentCount.increment();
          }
        }
      }
      try {
        sleep(resolution);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
  }