@Override public String getSignature(CallStackElement callTreeElement) { final String shortSignature = callTreeElement.getShortSignature(); if (shortSignature != null) { return shortSignature; } else { return callTreeElement.getSignature(); } }
@Override public ElementMatcher.Junction<TypeDescription> getExtraExcludeTypeMatcher() { return makeSureClassesAreNotProfiledTwice(); }
@Override public String getSignature(CallStackElement callTreeElement) { return callTreeElement.getSignature(); }
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_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() {
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 CallStackElement method0() { final CallStackElement callStackElement = Profiler.activateProfiling("method0()"); try { method1(); return callStackElement; } finally { final CallStackElement thisCallStackElement = Profiler.getMethodCallParent(); Profiler.stop(); thisCallStackElement.setExecutionTime(1000000000); } }
@Override public void onStart(SpanWrapper spanWrapper) { final SpanContextInformation contextInfo = SpanContextInformation.forSpan(spanWrapper); if (tracingPlugin.isSampled(spanWrapper) && contextInfo.getPreExecutionInterceptorContext() != null) { determineIfEnableProfiler(spanWrapper, contextInfo); if (!Profiler.isProfilingActive() && contextInfo.getPreExecutionInterceptorContext().isCollectCallTree()) { contextInfo.setCallTree(Profiler.activateProfiling("total")); } } }
private void appendTimesPercentTable(long totalExecutionTimeNs, StringBuilder sb, boolean asciiArt) { appendNumber(sb, getNetExecutionTime()); appendPercent(sb, getNetExecutionTime(), totalExecutionTimeNs, asciiArt); appendNumber(sb, getExecutionTime()); appendPercent(sb, getExecutionTime(), totalExecutionTimeNs, asciiArt); }
@Advice.OnMethodEnter public static void enter(@ProfilerSignature String signature) { Profiler.start(signature); }
private boolean isLastChild() { if (parent == null) { return true; } final List<CallStackElement> parentChildren = parent.getChildren(); return parentChildren.get(parentChildren.size() - 1) == this; }
public static void addIOCall(String signature, long executionTimeNanos) { addCall(signature + ' ', executionTimeNanos); }
/** * * @param timestamp the stop timestamp * @param minExecutionTime the threshold for the minimum execution time * @return the parent of this {@link CallStackElement} */ public CallStackElement executionStopped(long timestamp, long minExecutionTime) { // executionTime is initialized to start timestamp long localExecutionTime = timestamp - this.executionTime; this.executionTime = localExecutionTime; if (localExecutionTime < minExecutionTime && parent != null) { // <this> is always the last entry in parent.getChildren() parent.removeLastChild(); } return parent; }
public static void start(String signature) { final CallStackElement parent = methodCallParent.get(); if (parent != null) { methodCallParent.set(CallStackElement.create(parent, signature)); } }
private SpanContextInformation invokeEventListener() { return invokeEventListener(true); }
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); } }