@Override public void choiceGeneratorSet(VM vm, ChoiceGenerator<?> newCG) { ChoiceGenerator<?> cg = VM.getVM().getChoiceGenerator(); if (cg instanceof ThreadChoiceGenerator) { threadCGs++; Instruction insn = cg.getInsn(); if (insn instanceof JVMFieldInstruction) { sharedAccessCGs++; } else if (insn instanceof LockInstruction || insn instanceof JVMInvokeInstruction) { monitorCGs++; } else if (insn instanceof EXECUTENATIVE) { MethodInfo mi = insn.getMethodInfo(); if (mi != null) { ClassInfo ci = mi.getClassInfo(); if (ci != null) { if (ci.isObjectClassInfo()) { // its got to be either a wait or a notify since we know the java.lang.Object methods signalCGs++; } else if (ci.isThreadClassInfo()) { threadApiCGs++; } } else { // Hmm - a CG from a synthetic method? } } else { // even more Hmmm - a GC from a synthesized instruction } } else { breakTransitionCGs++; // e.g. max_transition_length or idleLoop breakers } } else { dataCGs++; } }
@Override public void methodExited(VM vm, ThreadInfo ti, MethodInfo mi) { if (traceActive) { assertSame(mi, ThreadInfo.getCurrentThread().getTopFrameMethodInfo()); if (CLSNAME.equals(mi.getClassName())) { level--; String prefix = levelPrefix(level); trace.add(prefix + "< " + mi.getName()); System.out.println(prefix + "< " + mi.getName()); if (level == 0) { traceActive = false; } } } }
@Override public void methodEntered(VM vm, ThreadInfo ti, MethodInfo mi) { assertSame(mi, ThreadInfo.getCurrentThread().getTopFrameMethodInfo()); if (CLSNAME.equals(mi.getClassName())) { String mthName = mi.getName(); if (mthName.equals(startMthName)) { traceActive = true; level = 0; } if (traceActive) { String prefix = levelPrefix(level); trace.add(prefix + "> " + mthName); System.out.println(prefix + "> " + mthName); level++; } } }