Search in sources :

Example 1 with MethodInfo

use of com.newrelic.agent.profile.method.MethodInfo in project newrelic-java-agent by newrelic.

the class ProfiledMethodFactory method getProfiledMethod.

public ProfiledMethod getProfiledMethod(Tracer tracer) {
    ClassMethodSignature methodSignature = tracer.getClassMethodSignature();
    ProfiledMethod method = getTracerMethods().get(methodSignature);
    if (method == null) {
        StackTraceElement stackTraceElement = new StackTraceElement(methodSignature.getClassName(), methodSignature.getMethodName(), null, -1);
        method = ProfiledMethod.newProfiledMethod(getNextMethodId(), profile, stackTraceElement);
        if (method != null) {
            ProfiledMethod previous = getTracerMethods().putIfAbsent(methodSignature, method);
            if (null != previous) {
                method = previous;
            } else {
                MethodInfo methodInfo = getMethodInfo(methodSignature);
                method.setMethodInfo(methodInfo);
            }
        }
    }
    return method;
}
Also used : ClassMethodSignature(com.newrelic.agent.tracers.ClassMethodSignature) ExactMethodInfo(com.newrelic.agent.profile.method.ExactMethodInfo) MethodInfo(com.newrelic.agent.profile.method.MethodInfo)

Example 2 with MethodInfo

use of com.newrelic.agent.profile.method.MethodInfo in project newrelic-java-agent by newrelic.

the class ProfiledMethodFactory method getMethodInfo.

public MethodInfo getMethodInfo(ClassMethodSignature methodSignature) {
    MethodInfo methodInfo = methodInfos.get(methodSignature);
    if (null == methodInfo) {
        Type[] argumentTypes = Type.getArgumentTypes(methodSignature.getMethodDesc());
        List<String> arguments = new ArrayList<>(argumentTypes.length);
        for (Type t : argumentTypes) {
            arguments.add(t.getClassName());
        }
        methodInfo = new ExactMethodInfo(arguments, (InstrumentedMethod) null);
        MethodInfo previous = methodInfos.putIfAbsent(methodSignature, methodInfo);
        if (previous != null) {
            return previous;
        }
    }
    return methodInfo;
}
Also used : Type(org.objectweb.asm.Type) ExactMethodInfo(com.newrelic.agent.profile.method.ExactMethodInfo) ArrayList(java.util.ArrayList) InstrumentedMethod(com.newrelic.agent.instrumentation.InstrumentedMethod) ExactMethodInfo(com.newrelic.agent.profile.method.ExactMethodInfo) MethodInfo(com.newrelic.agent.profile.method.MethodInfo)

Aggregations

ExactMethodInfo (com.newrelic.agent.profile.method.ExactMethodInfo)2 MethodInfo (com.newrelic.agent.profile.method.MethodInfo)2 InstrumentedMethod (com.newrelic.agent.instrumentation.InstrumentedMethod)1 ClassMethodSignature (com.newrelic.agent.tracers.ClassMethodSignature)1 ArrayList (java.util.ArrayList)1 Type (org.objectweb.asm.Type)1