Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] lazyTJP optimization for around advice

Hello,

I am using AspectJ to log performance of code and want to minimize the
impact on code when profiling is disabled. I have decompiled some
AspectJ-woven code:
public int echo(int num) {
	int i = num;
	org.aspectj.lang.JoinPoint localJoinPoint =
org.aspectj.runtime.reflect.Factory
			.makeJP(ajc$tjp_0, this, this, Conversions.intObject(i));
	return Conversions.intValue(echo_aroundBody1$advice(this, i,
			localJoinPoint, aj.ScrapAspect.aspectOf(),
			(org.aspectj.lang.ProceedingJoinPoint) localJoinPoint, i));
}


Basically, I want to forego the JoinPoint instantiation in the case of
profiling being disabled for a method by adding an if pointcut calling the
static Profiler.enabled() function /dependent on the name of the method/.

@Pointcut("(execution(* Print.ech*(int))) && args(i) && if()")
public static boolean pc(int i, JoinPoint.StaticPart
thisJoinPointStaticPart) {
	return
Profiler.enabled(thisJoinPointStaticPart.getSignature().getDeclaringTypeName());
}
@Around("pc(i)")
public Object profileMethods(ProceedingJoinPoint thisJoinPoint, int i)
	throws Throwable {
	return Profiler.profile(thisJoinPoint, i);
}


I saw  the bug request
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=311749>   and was wondering
if it has been implemented.
Also, does my conditional pointcut really stop the join point instantiation
(because it is only using the static part)?



--
View this message in context: http://aspectj.2085585.n4.nabble.com/lazyTJP-optimization-for-around-advice-tp4650646.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top