@Advice.OnMethodEnter public static void enter(@ProfilerSignature String signature) { Profiler.start(signature); }
public String getFoo() { Profiler.start("String org.stagemonitor.tracing.freemarker.FreemarkerProfilingTransformerTest$TemplateModel.getFoo()"); try { return "foo"; } finally { Profiler.stop(); } } }
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); } }
@Advice.OnMethodEnter(inline = false) public static void onBeforeEvaluate(@Advice.Argument(0) Environment env, @Advice.This Expression dot) { Profiler.start(env.getCurrentTemplate().getName() + ':' + dot.getBeginLine() + '#' + dot.toString()); }
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); } }
@Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { final Scope scope = new ExternalHttpRequest(tracingPlugin.getTracer(), request.getMethod().toString(), removeQuery(request.getURI()), request.getURI().getHost(), request.getURI().getPort()).createScope(); try { Profiler.start(request.getMethod().toString() + " " + request.getURI() + " "); tracingPlugin.getTracer().inject(scope.span().context(), Format.Builtin.HTTP_HEADERS, new SpringHttpRequestInjectAdapter(request)); return execution.execute(request, body); } finally { Profiler.stop(); scope.close(); } }
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(); }