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;
    }