示例#1
0
 /** * Code to be instrumented when a method is exited. */
 private void onMethodExitInstrumentation() {
   if (!iparams.usingExternalInstrumentation() || methodName.endsWith("init>")) {
     if (iparams.methodShouldBeAdapted(methodId)) {
       if (isMethodDescribedByPerformanceModel()) {
         if (!shouldMethodBodyBeRemoved()) {
           // Only the case that real code is executed under performance model time will call this
           BasicBlockAdapter.insertMethodInstrument(mv, methodId, "_exitPerfModel");
         } else {
           BasicBlockAdapter.insertMethodInstrument(mv, methodId, "_exitPerfModel");
         }
       } else {
         BasicBlockAdapter.insertMethodInstrument(
             mv, methodId, BasicBlockAdapter.vtfMethodExitCallback);
       }
     }
   }
 }
示例#2
0
 /** * Code to be instrumented when a method is entered. */
 private void onMethodEntryInstrumentation() {
   if (!iparams.usingExternalInstrumentation() || methodName.endsWith("init>")) {
     if (iparams.methodShouldBeAdapted(methodId)) {
       if (isMethodDescribedByPerformanceModel()) {
         if (!shouldMethodBodyBeRemoved()) {
           // The method body will be executed as normal, but the performance impact will only
           // depend on the provided model
           // This is used to simulate the behaviour, but still get the correct behaviour
           BasicBlockAdapter.insertMethodInstrument(mv, methodId, "_enterPerfModel");
         } else {
           // No method behaviour, just performance cost added by the model
           BasicBlockAdapter.insertMethodInstrument(mv, methodId, "_enterPerfModel");
         }
       } else {
         BasicBlockAdapter.insertMethodInstrument(
             mv, methodId, BasicBlockAdapter.vtfMethodEntryCallback);
       }
     }
   }
 }