[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] method's calls
|
- From: Andrew Eisenberg <andrew@xxxxxxxxxxxx>
- Date: Mon, 27 Apr 2009 15:14:28 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=md/2H3bulSPZiGFPP0qzAakEEGhk2PNFXxxexo5dvWc=; b=H1IxErrfF608eK8QDn0eMJT9DpKtHWMS1cAnEo47t0Ruh/4Wn6Tx9hEOW74Al3uGIn YmD0F4TiRU2S+kNfWOXDR1RRXnGrl0itCBogNjGkieG2qO8dqKh+Y2rvbrkQrxI0GttU mcuDmPosnkbbD9rK8hJLIGp4qJUK7zFgPKLV8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=tEkQXLw/9wcynV1/ftCJSIGo4nHbX4svNhCEHsOTUB2sdAbCy1bxBgW3ulR5zh4L8p JpN14VXC/iVowMGbOZk4eUnYAIDvzXazZuR/ve8Jc5gX056ZH/mKF1LRIveDn92ktFHX gRr0LEb3EW8JJ3lbk1FPwc1jsbWhEwaS9Gge8=
Hi,
You can find the AspectJ programming guide here:
http://www.eclipse.org/aspectj/doc/released/progguide/index.html
It is a good reference for the language.
Here is a nice intro:
http://www.javaworld.com/javaworld/jw-01-2002/jw-0118-aspect.html
As for your question, try this (this captures only the particular
method with 3 integer arguments):
aspect CounterAspect {
static int counter = 0;
pointcut interestingMethod() : execution(public int
MyClass.myMethod(int, int, int);
before() : interestingMethod() {
counter++;
}
around() : interestingMethod() {
int start = System.currentTimeMillis();
proceed();
int end = System.currentTimeMillis();
System.out.println("Time taken: " + (end - start));
}
}
On Mon, Apr 27, 2009 at 2:43 PM, Diana Cerbu <diana.cerbu@xxxxxxxxx> wrote:
> Hello,
>
>
>
> I am a novice in AspectJ and I’m trying to count the number of calls for a
> method or the duration of one. Does anyone have a clue? I also would like
> some advice about a good AspectJ documentation/help. Thanks.
>
>
>
> Regards,
>
> Diana
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>