------------------------------------------------------------
Intro:
This is a small program that measures the performance of given java classes.
In snippet there are 2 classes:
1. TestClass.java contains all java classes that are being measured for performance, I've picked up Narue's Sorting Algorithms as AUT (application under test)
2. AJPerf.java: contains the aspect that actually does the work of measuring.
------------------------------------------------------------
Requirements:
Here are the tools/versions used:
- AspectJ Compiler 1.5.2 built on Friday Jun 30, 2006 at 09:30:27 GMT
Can be downloaded from here.
- java version "1.5.0_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03)
Java HotSpot(TM) Client VM (build 1.5.0_09-b03, mixed mode, sharing)
Can be downloaded from here.
I was using Windows NT 5.0 build 2195 Service Pack 4, but should work on all platforms due to Java.
------------------------------------------------------------
Here is how to use it for your class(s):
1. Install aspectJ compiler and JRE/JDK 1.5+
2. Look for TODO in AJPerf.java and make required modifications. Just 3 of them as I see it.
3. Compile using aspectJ compiler. (ajc)
4. Run using aspectJ runner. (aj)
5. Copy and paste the output to excel sheet. Goto Data->Text to columns...
Select "Delimited" and press Next
Check "Other" and type "#" in edit box next to it.
Click finish.
-------------------------------
Example output:
Here is what I had to do if it helps:
E:\Temp\AJPerf> set CLASSPATH=%CLASSPATH%:/home/om1/aspectj1.5/lib/aspectjlib.jar:/home/om1/aspectj1.5/lib/aspectjrt.jar:/home/om1/aspectj1.5/lib/aspectjtools.jar:/home/om1/aspectj1.5/lib/aspectjweaver.jar
E:\Temp\AJPerf> ajc -1.5 -d . *.java
E:\Temp\AJPerf> aj -classpath E:\AspectJ\lib\aspectjweaver.jar;.;E:\AspectJ\lib\aspectjrt.jar;E:\AspectJ\lib\aspectjtools.jar;E:\AspectJ\lib\aspectjlib.jar AJPerf
The OUTPUT:
Function Name#Total Time#Number of calls#Time per call
void in.kash.test.TestClass.SortSelection.push_down(Integer[], int, int)#23483420#2900#8097.0
void in.kash.test.TestClass.SortInsertion.shell_sort(Integer[], int)#971352#100#9713.0
void in.kash.test.TestClass.SortInsertion.insertion_sort(Integer[], int)#2366772#200#11833.0
void in.kash.test.TestClass.SortExchange.quicksort(Integer[], int, int)#1239543#100#12395.0
void in.kash.test.TestClass.SortExchange.quicksort(Integer[], int)#21682929#100#216829.0
void in.kash.test.TestClass.SortExchange.bubble_sort(Integer[], int)#843949#100#8439.0
void in.kash.test.TestClass.main(String[])#210874287#1#2.10874287E8
void in.kash.test.TestClass.SortSelection.selection_sort(Integer[], int)#1347096#100#13470.0
void in.kash.test.TestClass.SortSelection.heapsort(Integer[], int)#44056719#100#440567.0
E:\Temp\AJPerf>