Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » Runtime/Dynamic pointcuts
Runtime/Dynamic pointcuts [message #71872] Wed, 25 June 2008 13:14 Go to next message
Eclipse User
Originally posted by: Paul.Carroll.ericsson.com

We've noticed a performance drop in one of our applications when using
code woven with aspects (using aspectj 1.5 or 1.6) and resolved it down to
the cflow point cut.

We need the trace generated so can't really remove cuts but one thing I
was looking to do was see if there is a way for a pointcut to make a java
call instead i.e. if trace is off then there's no point in running any of
the other point cuts i.e.
Before :
pointcut publicMethods (execution (public * com.ab.b.d.*.*(..));
before() : cflowbelow(publicMethods()) {
// Do some tracing....
}
after() returning : cflowbelow(publicMethods()) {
// Do some trace.....
}

After
pointcut publicMethods (execution (public * com.ab.b.d.*.*(..));
pointcut isTracingOn (.........);
before() : isTracingOn(...) && cflowbelow(publicMethods()) {
// Do some tracing....
}

The end result would be that isTracingOn() would resolve to false and
other pointcuts are not checked/executed thus cflowbelow doesn't run....

OR is there a way to dynamically turn off aspects in woven code i.e. they
never get evaluated, so there should be zero performance difference
between running unwoven code and code woven but the aspects turned off.
Re: Runtime/Dynamic pointcuts [message #71987 is a reply to message #71872] Wed, 16 July 2008 20:59 Go to previous message
Andrew Clement is currently offline Andrew Clement
Messages: 162
Registered: July 2009
Senior Member
Sorry for the late reply - I don't check the newsgroup very often. If you
want a faster reply (and more people to read your post), please use the
mailing lists if you can.

A typical trace guard is a static boolean.

public static boolean traceEnabled = false;

And then a check for it is added to all pointcuts

pointcut shouldTrace(): if(SomeType.traceEnabled);

before(): execution(* *(..)) && shouldTrace() {
// do expensive thing
}

Only static info is supported in if() at the moment so it is a global
control for tracing. The subject of efficient tracing has come up on the
mailing list now and again, try taking a look through the archives:
http://dev.eclipse.org/mhonarc/lists/aspectj-users/maillist. html

And be careful with cflow as it isn't cheap - are you absolutely sure you
need it?

Andy.
Re: Runtime/Dynamic pointcuts [message #597093 is a reply to message #71872] Wed, 16 July 2008 20:59 Go to previous message
Andrew Clement is currently offline Andrew Clement
Messages: 162
Registered: July 2009
Senior Member
Sorry for the late reply - I don't check the newsgroup very often. If you
want a faster reply (and more people to read your post), please use the
mailing lists if you can.

A typical trace guard is a static boolean.

public static boolean traceEnabled = false;

And then a check for it is added to all pointcuts

pointcut shouldTrace(): if(SomeType.traceEnabled);

before(): execution(* *(..)) && shouldTrace() {
// do expensive thing
}

Only static info is supported in if() at the moment so it is a global
control for tracing. The subject of efficient tracing has come up on the
mailing list now and again, try taking a look through the archives:
http://dev.eclipse.org/mhonarc/lists/aspectj-users/maillist. html

And be careful with cflow as it isn't cheap - are you absolutely sure you
need it?

Andy.
Previous Topic:Why is not AJDT looking in the plugin dependencies ?
Next Topic:RCP Application LTW problem
Goto Forum:
  


Current Time: Tue Sep 23 08:31:23 GMT 2014

Powered by FUDForum. Page generated in 0.07431 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software