@Advice.OnMethodExit(inline = false, onThrowable = Throwable.class) public static void onAfterEvaluate() { final CallStackElement currentFreemarkerCall = Profiler.getMethodCallParent(); Profiler.stop(); removeCurrentNodeIfItHasNoChildren(currentFreemarkerCall); }
static void method1_1_1() { Profiler.start("method1_1_1()"); final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(200000000); }
static void method1_1_2_1() { Profiler.start("method1_1_2_1()"); final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(50000000); }
static void method1_2_1() { Profiler.start("method1_2_1()"); final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(250000000); } }
static CallStackElement method0() { final CallStackElement callStackElement = Profiler.activateProfiling("method0()"); try { method1(); return callStackElement; } finally { final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(1000000000); } }
static void method1_1_2() { Profiler.start("method1_1_2()"); try { method1_1_2_1(); } finally { final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(250000000); } }
static void method1_1() { Profiler.start("method1_1()"); try { method1_1_1(); method1_1_2(); } finally { final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(500000000); } }
static void method1() { Profiler.start("method1()"); try { method1_1(); method1_2(); } finally { final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(1000000000); } }
static void method1_2() { Profiler.start("method1_2()"); Profiler.addIOCall("select * from user", 50000000); Profiler.addIOCall("select * from address", 50000000); method1_2_1(); final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(500000000); } static void method1_2_1() {
@Test public void testNoProfilingIfNotActive() { assertFalse(Profiler.isProfilingActive()); Profiler.start("dummy"); assertNull(Profiler.getMethodCallParent()); Profiler.stop(); }