[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] (no subject)

On 27 October 2011 04:24, Shambhavi Joshi <shambhavi.jj@xxxxxxxxx> wrote:
> Hello
> I wanted some clarifications regarding your code.
> What does this statement do? "call(* *(..)) && !within(CallGraph)"
> I guess this statement checks for any function call but not within the given
> aspect CallGraph. But still, could you please throw light on the syntax used
> in the statement?

Yep, it is says I am interested in the all method calls but not those
made by any code in CallGraph.  On second throughts it should perhaps
have included a cflow as you aren't interested in anything downstream
of any calls the aspect makes either.  Maybe: call(* *(..)) &&
!cflow(adviceexecution())

> Instead of printing the function calls, can i store each function in a file further use?

You can do what you want with it.  Open a file and append to it in the
advice, but that may perform slowly.

cheers
Andy

> Thank You
> On Mon, Oct 17, 2011 at 11:05 PM, Andy Clement <andrew.clement@xxxxxxxxx>
> wrote:
>>
>> Hi,
>>
>> I don't have a complete solution for you to pick up and use but this
>> aspect kind of does it:
>>
>> aspect CallGraph {
>>  int indent =0;
>>  before(): call(* *(..)) && !within(CallGraph) {
>>     for (int i=0;i<indent;i++) { System.out.print("  ");}
>>     System.out.println("> "+thisJoinPointStaticPart);
>>     indent++;
>>  }
>>  after(): call(* *(..))&& !within(CallGraph)  {
>>    indent--;
>>  }
>> }
>>
>> public class Code {
>> public static void main(String []argv) {
>>  new Code().foo();
>>  new Code().bar();
>> }
>>
>>  public void foo() {
>>    bar();
>>  }
>>  public void bar() {
>>    boo();
>>  }
>>  public void boo() {
>>    System.out.println("Hello World");
>>  }
>> }
>>
>> Running it gives:
>> $ java Code
>> > call(void Code.foo())
>>  > call(void Code.bar())
>>    > call(void Code.boo())
>>      > call(void java.io.PrintStream.println(String))
>> Hello World
>> > call(void Code.bar())
>>  > call(void Code.boo())
>>    > call(void java.io.PrintStream.println(String))
>> Hello World
>>
>> Andy
>>
>> On 15 October 2011 07:19, Shambhavi Joshi <shambhavi.jj@xxxxxxxxx> wrote:
>> > Hello
>> >
>> > I want to design a code for generating a run-time call graph for a
>> > Java program using AspectJ.
>> > Can anybody tell me how to go about it?? please its urgent.
>> > Is there any algorithm available, if yes, then please provide /suggest
>> > me the same.
>> >
>> > Please do reply ASAP
>> > Shambhavi
>> > _______________________________________________
>> > aspectj-users mailing list
>> > aspectj-users@xxxxxxxxxxx
>> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> >
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
>
> --
> Shambhavi Joshi
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>