code: private boolean isProfilingEnabled() {
          Class<?> mergedClass = mUnit.getRuntimeContext();
          boolean profilingEnabled = true;
  
          try {
              Method a = mergedClass.getDeclaredMethod("getObserverMode");
              int observerMode = ((Integer) a.invoke(null)).intValue();
              profilingEnabled = (observerMode & MergedClass.OBSERVER_ENABLED) != 0 &&
                  (observerMode & MergedClass.OBSERVER_EXTERNAL) != 0;
          }
          catch (Exception ex) { profilingEnabled = false; }
          return profilingEnabled;
      }
docs: /*
  Check context to see if profiling is enabled by checking
  the observer mode in the context.  Generate inline profiling
  calls to the observer if it is expecting events to be external
  to the MergedClass.