Esempio n. 1
0
void FlatProfiler::record_tick_for_running_frame(frame fr) {
  // The tick happend in real code -> non VM code
  if (fr.is_interpreted_frame()) {
    methodOop method = fr.method();
    if (method == NULL) return;
    assert(method->is_method(), "must be method");
    FlatProfiler::interpreted_update(method, fr.receiver()->klass(), in_code);

  } else if (fr.is_compiled_frame()) {
    FlatProfiler::compiled_update(findNMethod(fr.pc()), in_code);

  } else if (PIC::in_heap(fr.pc())) {
    PIC* pic = PIC::find(fr.pc());
    FlatProfiler::compiled_update(findNMethod((char*) pic->compiled_ic()), in_pic);

  } else if (StubRoutines::contains(fr.pc())) {
    FlatProfiler::stub_ticks++;
  }
}
Esempio n. 2
0
void FlatProfiler::record_tick_for_calling_frame(frame fr) {
  // The tick happend in VM code

  TickPosition where = other;
  if (theCompiler) { 
    where = in_compiler;
  }
  if (fr.is_interpreted_frame()) {
    methodOop method = fr.method();
    if (method == NULL) return;
    assert(method->is_method(), "must be method");
    int bci = method->bci_from(fr.hp());
    if (Bytecodes::code_type((Bytecodes::Code) *method->codes(bci)) == Bytecodes::primitive_call) {
      where = in_primitive;
    }
    FlatProfiler::interpreted_update(method, fr.receiver()->klass(), where);

  } else if (fr.is_compiled_frame()) {
    nmethod* nm = findNMethod(fr.pc());
    relocIterator iter(nm);
    while (iter.next()) {
      if (iter.is_call() && iter.call_end() == fr.pc()) {
        if (iter.type() == relocInfo::prim_type)
	  where = in_primitive;
      }
    }
    FlatProfiler::compiled_update(nm, where);

  } else {
    if (StubRoutines::contains(fr.pc())) {
      FlatProfiler::stub_ticks++;
    } else {
      FlatProfiler::unknown_ticks++;
    }
  }
}