summaryrefslogtreecommitdiffstats
path: root/tests/profiling
diff options
context:
space:
mode:
authoracolyer <acolyer>2006-01-20 12:28:01 +0000
committeracolyer <acolyer>2006-01-20 12:28:01 +0000
commit17865f45b709f5b8adf86acff50dd5d05ea4a4f0 (patch)
tree206c74e8fb7aa6326fb8b3a30153cc03b41a6d5e /tests/profiling
parent7a9a69e5c82ee9ee59f94cc68d69a3c25c36b5ff (diff)
downloadaspectj-17865f45b709f5b8adf86acff50dd5d05ea4a4f0.tar.gz
aspectj-17865f45b709f5b8adf86acff50dd5d05ea4a4f0.zip
ant script for running profiling tests against aspectj with ajc source compile, binary weaving, load-time weaving, and AJDT simulation. Can configure target application and source of compiler (workspace or pre-built jars).
Diffstat (limited to 'tests/profiling')
-rw-r--r--tests/profiling/.cvsignore4
-rw-r--r--tests/profiling/aspects/readme.txt8
-rw-r--r--tests/profiling/aspects/simple-suite/src/META-INF/aop.xml5
-rw-r--r--tests/profiling/aspects/simple-suite/src/org/aspectj/profiling/WorkTheWeaver.aj21
-rw-r--r--tests/profiling/build.properties98
-rw-r--r--tests/profiling/build.xml418
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$1$Args.classbin0 -> 1621 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$1.classbin0 -> 536 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$2.classbin0 -> 660 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$AntMessageHandler.classbin0 -> 2231 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$GuardedCommand.classbin0 -> 4039 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask.classbin0 -> 40664 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$1.classbin0 -> 740 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$Holder.classbin0 -> 1121 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$InfoHolder.classbin0 -> 975 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$MessageHolderChecker.classbin0 -> 2997 bytes
-rw-r--r--tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest.classbin0 -> 22332 bytes
-rw-r--r--tests/profiling/classes/readme.txt6
-rw-r--r--tests/profiling/ltw-app/META-INF/aop.xml5
-rw-r--r--tests/profiling/ltw-app/src/org/aspectj/profiling/LTWApp.java74
-rw-r--r--tests/profiling/readme.txt8
-rw-r--r--tests/profiling/spring-1.2.6.xml62
22 files changed, 709 insertions, 0 deletions
diff --git a/tests/profiling/.cvsignore b/tests/profiling/.cvsignore
new file mode 100644
index 000000000..189c180cf
--- /dev/null
+++ b/tests/profiling/.cvsignore
@@ -0,0 +1,4 @@
+results
+gc.txt
+java.hprof.txt
+project.properties
diff --git a/tests/profiling/aspects/readme.txt b/tests/profiling/aspects/readme.txt
new file mode 100644
index 000000000..c7409545d
--- /dev/null
+++ b/tests/profiling/aspects/readme.txt
@@ -0,0 +1,8 @@
+Some sample aspects that will by default be woven with the
+target application.
+
+Designed to make sure that ajc has plenty of work to do!!
+
+Only the "simple-suite" has been defined so far, but you could
+define other aspect suites to exercise different workloads, and
+use them by setting the test.aspects.src.dir property
diff --git a/tests/profiling/aspects/simple-suite/src/META-INF/aop.xml b/tests/profiling/aspects/simple-suite/src/META-INF/aop.xml
new file mode 100644
index 000000000..6378d9301
--- /dev/null
+++ b/tests/profiling/aspects/simple-suite/src/META-INF/aop.xml
@@ -0,0 +1,5 @@
+<aspectj>
+ <aspects>
+ <aspect name="org.aspectj.profiling.WorkTheWeaver"/>
+ </aspects>
+</aspectj> \ No newline at end of file
diff --git a/tests/profiling/aspects/simple-suite/src/org/aspectj/profiling/WorkTheWeaver.aj b/tests/profiling/aspects/simple-suite/src/org/aspectj/profiling/WorkTheWeaver.aj
new file mode 100644
index 000000000..9321decee
--- /dev/null
+++ b/tests/profiling/aspects/simple-suite/src/org/aspectj/profiling/WorkTheWeaver.aj
@@ -0,0 +1,21 @@
+package org.aspectj.profiling;
+
+public aspect WorkTheWeaver {
+
+ before() : execution(* set*(..)) {
+ System.out.println("before setter...");
+ }
+
+ after() returning : execution(* set*(..)) {
+ System.out.println("after returning from setter...");
+ }
+
+ // using "call" on an interface type will cause us to chase
+ // all the way up the inheritance hierarchies of any type we
+ // call.
+ // it also means we have to crack open methods when weaving...
+ declare warning : call(* java.lang.Runnable+.*(..))
+ : "call to a subtype of runnable";
+
+
+} \ No newline at end of file
diff --git a/tests/profiling/build.properties b/tests/profiling/build.properties
new file mode 100644
index 000000000..2718ca584
--- /dev/null
+++ b/tests/profiling/build.properties
@@ -0,0 +1,98 @@
+# Version controlled properties for profiling ant script
+# You can locally override properties defined here by placing
+# them in a project.properties file in the same directory.
+#
+# Do not check your project.properties file into CVS!
+
+# directory containing aspectj libraries (aspectj[tools|weaver|rt].jar)
+aspectj.lib.dir=../../aj-build/dist/tools/lib
+
+# root directory of your workspace containing the aspectj tree (if
+# using head for profiling as opposed to a built version of aspectj)
+aspectj.workspace.root=../..
+
+# set this property to false in your project.properties to use the contents of your workspace
+# for compilation, as opposed to the jars in aspectj.lib.dir
+use.aspectjtools.jar=true
+
+# the iajc task that ships with 1.5.0 or any prior release does
+# not support the need <jvmarg> nested attribute that this
+# profiling script needs. To profile AspectJ versions < 1.5.1,
+# use the local copy of AjcTask in the "classes" folder by
+# defining the following property
+use.local.iajc.task.class=true
+
+# directory in which results will be placed
+results.dir=results
+
+# source and target levels for compilation
+source.level=1.5
+target.level=1.5
+
+# the maximum memory to make available for the compilation/weaving
+ajc.maxmem=768m
+
+# the name of the file containing the path definitions needed to compile
+# a particular target application as the subject of the profiling
+# we profile the compilation and weaving of spring 1.2.6 by default.
+target.application.definitions.file=./spring-1.2.6.xml
+
+# target application name, used as the subdirectory under results to store
+# profiling results
+target.application.name=spring-1.2.6
+
+# source root directory for the aspects you want to compile and weave alongside
+# the target application (unless it contains sufficient aspects on its own...)
+test.aspects.src.dir=./aspects/simple-suite/src
+
+# installation dir of a spring-1.2.6 distribution. you will need to set this
+# in project.properties unless you point the target.application.definitions.file
+# to compile a different target application altogether.
+spring.install.dir=must-set-spring.install.dir-property-in-project.properties
+
+# for binary and loadtime weaving, the location of the jar file that will be
+# woven into
+weave.injar=${spring.install.dir}/dist/spring.jar
+
+# location of aop.xml file to be included when load-time weaving
+# use this to control the set of types exposed to the weaver so as to
+# match the set of types woven in the other modes for fair comparisons
+# across weave times
+ltw.aop.xml=./ltw-app/META-INF/aop.xml
+
+# args to pass to vm for hprof run
+#
+# hprof usage: java -agentlib:hprof=[help]|[<option>=<value>, ...]
+#
+# Option Name and Value Description Default
+# --------------------- ----------- -------
+# heap=dump|sites|all heap profiling all
+# cpu=samples|times|old CPU usage off
+# monitor=y|n monitor contention n
+# format=a|b text(txt) or binary output a
+# file=<file> write data to file java.hprof[.txt]
+# net=<host>:<port> send data over a socket off
+# depth=<size> stack trace depth 4
+# interval=<ms> sample interval in ms 10
+# cutoff=<value> output cutoff point 0.0001
+# lineno=y|n line number in traces? y
+# thread=y|n thread in traces? n
+# doe=y|n dump on exit? y
+# msa=y|n Solaris micro state accounting n
+# force=y|n force output to <file> y
+# verbose=y|n print messages about dumps y
+# see http://java.sun.com/developer/technicalArticles/Programming/HPROF.html
+hprof.args=-agentlib:hprof=heap=sites,cpu=samples
+# for full details on object allocation and reachability use heap=all instead
+# (v. large files)
+# for full timing info use cpu=times (much slower)
+# for Java 1.4 and below use the following style instead
+# hprof.args=-Xrunhprof:cpu=times
+
+# args to pass to vm for gc run
+# after a run this file will be copied into results/${target.application.name}/gt.<date-time>.txt
+# you can analyze it with JTune (http://www.hp.com/products1/unix/java/java2/hpjtune/index.html)
+# Start JTune with java -jar HPTune.jar
+gc.args=-Xloggc:gc.txt
+
+
diff --git a/tests/profiling/build.xml b/tests/profiling/build.xml
new file mode 100644
index 000000000..67ce475a1
--- /dev/null
+++ b/tests/profiling/build.xml
@@ -0,0 +1,418 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2006 contributors.
+
+ All rights reserved.
+ This program and the accompanying materials are made available
+ under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution and is available at
+ http://eclipse.org/legal/epl-v10.html
+
+ Contributors: Adrian Colyer
+-->
+
+<project name="aspectj-profiling" default="usage">
+
+ <!-- project.properties contains your local settings, not checked into CVS -->
+ <property file="project.properties"/>
+
+ <!-- default property settings, version controlled -->
+ <property file="build.properties"/>
+
+ <!-- pull in the ant file defining the paths etc. for the target application -->
+ <import file="${target.application.definitions.file}"/>
+
+ <!-- list of useful targets... -->
+ <target name="usage">
+ <echo message="ant build script for profiling AspectJ compiler"/>
+ <echo message="useful targets are:"/>
+ <echo message=" gc.suite : runs basic timing and gc for source, binary, ltw, and ajdt compiles"/>
+ <echo message=" full.profile.suite : runs full profiling for source, binary, ltw, and ajdt compiles"/>
+ <echo message=" source.compile : compiles from source (and weaves) with full profiling"/>
+ <echo message=" source.compile.gc : compiles from source (and weaves) with basic timing and gc"/>
+ <echo message=" binary.weave : binary weaving from injars and aspectpath with full profiling"/>
+ <echo message=" binary.weave.gc : binary weaving from injars and aspectpath with basic timing and gc"/>
+ <echo message=" loadtime.weave : load-time weaving with full profiling"/>
+ <echo message=" loadtime.weave.gc : load-time weaving with basic timing and gc"/>
+ <echo message=" ajdt.compile : source compile simulating ajdt usage of compiler with full profiling"/>
+ <echo message=" ajdt.compile.gc : source compile simulating ajdt usage of compiler with basic timing and gc"/>
+ <echo message=" clean : remove all output etc. and prepare for fresh run"/>
+ <echo message="results are placed in ${results.dir} for analysis with HAT, PerfAnal etc."/>
+ <echo message="customise behaviour using local project.properties (see build.properties"/>
+ <echo message="for available customisations)"/>
+ </target>
+
+ <!-- handy suites -->
+ <target name="gc.suite" depends="source.compile.gc,binary.weave.gc,loadtime.weave.gc,ajdt.compile.gc"/>
+ <target name="full.profile.suite" depends="source.compile,binary.weave,loadtime.weave,ajdt.compile"/>
+
+ <!--
+ how to obtain the aspectj compiler - if the use.aspectjtools.jar property
+ is set to true, will use the version of aspectjtools.jar in
+ aspectj.lib.dir. If use.aspectjtools.jar property is false, will use
+ the bin directories from the projects in your aspectj.workspace.root.
+ -->
+
+ <condition property="ajtools.jar">
+ <istrue value="${use.aspectjtools.jar}"/>
+ </condition>
+
+ <condition property="iajc.local">
+ <istrue value="${use.local.iajc.task.class}"/>
+ </condition>
+
+ <path id="aspectj.compiler.path">
+ <dirset dir=".">
+ <include name="classes" if="iajc.local"/>
+ </dirset>
+ <fileset dir="${aspectj.lib.dir}">
+ <include name="aspectjtools.jar" if="ajtools.jar"/>
+ </fileset>
+ <dirset dir="${aspectj.workspace.root}">
+ <include name="*/bin" unless="ajtools.jar"/>
+ </dirset>
+ <fileset dir="${aspectj.workspace.root}">
+ <include name="org.eclipse.jdt.core/jdtcore-for-aspectj.jar" unless="ajtools.jar"/>
+ <include name="lib/bcel/bcel.jar" unless="ajtools.jar"/>
+ </fileset>
+ </path>
+
+ <path id="ajde.launch.path">
+ <dirset dir="${aspectj.workspace.root}">
+ <include name="test*/bin"/>
+ </dirset>
+ </path>
+
+ <!-- define the iajc task -->
+ <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
+ <classpath>
+ <path refid="aspectj.compiler.path"/>
+ </classpath>
+ </taskdef>
+
+ <!-- some simple checking to give status messages about the config we will run with -->
+ <target name="config-check" depends="check.ajtools.jar,check.workspace,check.iajc.local,check.iajc.ajtools"/>
+ <target name="check.ajtools.jar" if="ajtools.jar">
+ <echo message="using aspectjtools.jar from ${aspectj.lib.dir}"/>
+ </target>
+ <target name="check.workspace" unless="ajtools.jar">
+ <echo message="using AspectJ from workspace at ${aspectj.workspace.root}"/>
+ </target>
+ <target name="check.iajc.local" if="iajc.local">
+ <echo message="using patched version of iajc supporting jvmargs"/>
+ </target>
+ <target name="check.iajc.ajtools" unless="iajc.local">
+ <echo message="using version of iajc from aspectjtools.jar"/>
+ </target>
+
+ <!-- init and clean... -->
+
+ <target name="init">
+ <mkdir dir="${results.dir}"/>
+ <mkdir dir="${results.dir}/${target.application.name}"/>
+ <mkdir dir="${results.dir}/ltw-app"/>
+ <mkdir dir="${results.dir}/ltw-app/META-INF"/>
+ </target>
+
+ <target name="clean" depends="init">
+ <delete dir="${results.dir}"/>
+ </target>
+
+ <!-- classpath to use for all targets -->
+
+ <path id="iajc.class.path">
+ <path refid="build.class.path"/>
+ <pathelement location="${aspectj.lib.dir}/aspectjrt.jar"/>
+ <path refid="aspectj.compiler.path"/>
+ </path>
+
+
+ <!-- source compilation (ajc style) with various profiling -->
+
+ <target name="source.compile" depends="init,config-check">
+ <iajc destdir="${results.dir}/${target.application.name}/classes"
+ fork="true" maxmem="${ajc.maxmem}"
+ debug="on"
+ source="${source.level}" target="${target.level}"
+ sourcerootsref="source.roots"
+ time="true"
+ forkclasspathref="iajc.class.path">
+ <jvmarg value="${hprof.args}"/>
+ <jvmarg value="${gc.args}"/>
+ </iajc>
+
+ <tstamp>
+ <format property="ajc.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
+ </tstamp>
+ <property name="ajc.hprof.out" value="${results.dir}/${target.application.name}/ajc.java.hprof.${ajc.runtime}.txt"/>
+ <property name="ajc.gc.out" value="${results.dir}/${target.application.name}/ajc.gc.${ajc.runtime}.txt"/>
+ <move file="java.hprof.txt" tofile="${ajc.hprof.out}"/>
+ <move file="gc.txt" tofile="${ajc.gc.out}"/>
+ <echo message="hprof data written to ${ajc.hprof.out}"/>
+ <echo message="gc data written to ${ajc.gc.out}"/>
+ <echo message="analyse with e.g. HATS and JTune"/>
+ </target>
+
+ <target name="source.compile.gc" depends="init,config-check">
+ <tstamp>
+ <format property="ajc.starttime" pattern="HH:mm:ss"/>
+ </tstamp>
+ <echo message="ajc compile started at: ${ajc.starttime}"/>
+
+ <iajc destdir="${results.dir}/${target.application.name}/classes"
+ fork="true" maxmem="${ajc.maxmem}"
+ debug="on"
+ source="${source.level}" target="${target.level}"
+ sourcerootsref="source.roots"
+ forkclasspathref="iajc.class.path"
+ time="true">
+ <jvmarg value="${gc.args}"/>
+ </iajc>
+
+ <tstamp>
+ <format property="ajc.endtime" pattern="HH:mm:ss"/>
+ </tstamp>
+ <echo message="ajc compile ended at: ${ajc.endtime} (started at ${ajc.starttime})"/>
+ <tstamp>
+ <format property="ajc.gc.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
+ </tstamp>
+ <property name="ajc.gc.only.out" value="${results.dir}/${target.application.name}/ajc.gc.${ajc.gc.runtime}.txt"/>
+ <move file="gc.txt" tofile="${ajc.gc.only.out}"/>
+ <echo message="gc data written to ${ajc.gc.only.out}"/>
+ <echo message="analyze with JTune"/>
+ </target>
+
+ <!-- binary weaving with various profiling options -->
+
+ <!-- build an aspect library to use for binary weaving, so that we
+ profile weaving only... -->
+ <target name="aspectlib" depends="init">
+ <iajc outjar="${results.dir}/aspectlib.jar"
+ debug="on"
+ source="${source.level}"
+ target="${target.level}"
+ sourceroots="${test.aspects.src.dir}"
+ sourceRootCopyFilter="**/*.java,**/*.aj,**/CVS/*"
+ classpathref="iajc.class.path">
+ </iajc>
+ </target>
+
+ <target name="binary.weave" depends="init,aspectlib">
+ <iajc outjar="${results.dir}/woven.jar"
+ debug="on"
+ source="${source.level}"
+ target="${target.level}"
+ fork="true"
+ forkclasspathref="iajc.class.path"
+ maxmem="${ajc.maxmem}">
+ <inpath>
+ <pathelement location="${weave.injar}"/>
+ </inpath>
+ <aspectpath>
+ <pathelement location="${results.dir}/aspectlib.jar"/>
+ </aspectpath>
+ <jvmarg value="${hprof.args}"/>
+ <jvmarg value="${gc.args}"/>
+ </iajc>
+
+ <tstamp>
+ <format property="bw.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
+ </tstamp>
+ <property name="bw.hprof.out" value="${results.dir}/${target.application.name}/weave.java.hprof.${bw.runtime}.txt"/>
+ <property name="bw.gc.out" value="${results.dir}/${target.application.name}/weave.gc.${bw.runtime}.txt"/>
+ <move file="java.hprof.txt" tofile="${bw.hprof.out}"/>
+ <move file="gc.txt" tofile="${bw.gc.out}"/>
+ <echo message="hprof data written to ${bw.hprof.out}"/>
+ <echo message="gc data written to ${bw.gc.out}"/>
+ <echo message="analyse with e.g. HATS and JTune"/>
+ </target>
+
+ <target name="binary.weave.gc" depends="init,aspectlib">
+ <tstamp>
+ <format property="bw.starttime" pattern="HH:mm:ss"/>
+ </tstamp>
+ <echo message="weave started at: ${bw.starttime}"/>
+
+ <iajc outjar="${results.dir}/woven.jar"
+ debug="on"
+ source="${source.level}"
+ target="${target.level}"
+ fork="true"
+ forkclasspathref="iajc.class.path"
+ maxmem="${ajc.maxmem}">
+ <inpath>
+ <pathelement location="${weave.injar}"/>
+ </inpath>
+ <aspectpath>
+ <pathelement location="${results.dir}/aspectlib.jar"/>
+ </aspectpath>
+ <jvmarg value="${gc.args}"/>
+ </iajc>
+
+ <tstamp>
+ <format property="bw.endtime" pattern="HH:mm:ss"/>
+ </tstamp>
+ <echo message="weave ended at: ${bw.endtime} (started at ${bw.starttime})"/>
+ <tstamp>
+ <format property="bw.gc.only.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
+ </tstamp>
+ <property name="bw.gc.only.out" value="${results.dir}/${target.application.name}/weave.gc.${bw.gc.only.runtime}.txt"/>
+ <move file="gc.txt" tofile="${bw.gc.only.out}"/>
+ <echo message="gc data written to ${bw.gc.only.out}"/>
+ <echo message="analyze with JTune"/>
+ </target>
+
+ <!-- loadtime weaving with various profiling options -->
+
+ <target name="ltw-app" depends="init"
+ description="builds an application that we can run with ltw. The app does
+ Class.forName(..) on every type within the jar file passed to
+ it as an argument, thus forcing all those types (and types they
+ reference) to be woven)">
+
+ <javac srcdir="ltw-app/src" destdir="${results.dir}/ltw-app">
+ </javac>
+ <copy file="${ltw.aop.xml}" todir="${results.dir}/ltw-app/META-INF"/>
+ </target>
+
+ <target name="check-using-jars" unless="ajtools.jar">
+ <echo message="WARNING: cannot run load-time weaving from workspace dirs"/>
+ <echo message="use.aspectjtools.jar setting will be ignored and the jar"/>
+ <echo message="${aspectj.lib.dir}/aspectjweaver.jar will be used for LTW instead"/>
+ </target>
+
+ <target name="loadtime.weave" depends="check-using-jars,aspectlib,ltw-app">
+ <java classname="org.aspectj.profiling.LTWApp"
+ fork="true"
+ maxmemory="${ajc.maxmem}">
+ <arg value="${weave.injar}"/>
+ <jvmarg value="${gc.args}"/>
+ <jvmarg value="${hprof.args}"/>
+ <jvmarg value="-javaagent:${aspectj.lib.dir}/aspectjweaver.jar"/>
+ <classpath>
+ <pathelement location="${results.dir}/ltw-app"/>
+ <pathelement location="${results.dir}/aspectlib.jar"/>
+ <pathelement location="${weave.injar}"/>
+ <path refid="iajc.class.path"/>
+ </classpath>
+ </java>
+ <tstamp>
+ <format property="ltw.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
+ </tstamp>
+ <property name="ltw.hprof.out" value="${results.dir}/${target.application.name}/ltw.java.hprof.${ltw.runtime}.txt"/>
+ <property name="ltw.gc.out" value="${results.dir}/${target.application.name}/ltw.gc.${ltw.runtime}.txt"/>
+ <move file="java.hprof.txt" tofile="${ltw.hprof.out}"/>
+ <move file="gc.txt" tofile="${ltw.gc.out}"/>
+ <echo message="hprof data written to ${ltw.hprof.out}"/>
+ <echo message="gc data written to ${ltw.gc.out}"/>
+ <echo message="analyse with e.g. HATS and JTune"/>
+ </target>
+
+ <target name="loadtime.weave.gc" depends="check-using-jars,aspectlib,ltw-app">
+ <tstamp>
+ <format property="ltw.starttime" pattern="HH:mm:ss"/>
+ </tstamp>
+ <echo message="ltw started at: ${ltw.starttime}"/>
+
+ <java classname="org.aspectj.profiling.LTWApp"
+ fork="true"
+ maxmemory="${ajc.maxmem}">
+ <arg value="${weave.injar}"/>
+ <jvmarg value="${gc.args}"/>
+ <jvmarg value="-javaagent:${aspectj.lib.dir}/aspectjweaver.jar"/>
+ <classpath>
+ <pathelement location="${results.dir}/ltw-app"/>
+ <pathelement location="${results.dir}/aspectlib.jar"/>
+ <pathelement location="${weave.injar}"/>
+ <path refid="iajc.class.path"/>
+ </classpath>
+ </java>
+
+ <tstamp>
+ <format property="ltw.endtime" pattern="HH:mm:ss"/>
+ </tstamp>
+ <echo message="ltw ended at: ${ltw.endtime} (started at ${ltw.starttime})"/>
+ <tstamp>
+ <format property="ltw.gc.only.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
+ </tstamp>
+ <property name="ltw.gc.only.out" value="${results.dir}/${target.application.name}/ltw.gc.${ltw.gc.only.runtime}.txt"/>
+ <move file="gc.txt" tofile="${ltw.gc.only.out}"/>
+ <echo message="gc data written to ${ltw.gc.only.out}"/>
+ <echo message="analyze with JTune"/>
+ </target>
+
+ <!-- "AJDT-like" compiles with various profiling options -->
+
+ <target name="prepare-project" depends="init">
+ <delete dir="${results.dir}/ajdt-workspace-root"/>
+ <mkdir dir="${results.dir}/ajdt-workspace-root"/>
+ <mkdir dir="${results.dir}/ajdt-workspace-root/${target.application.name}"/>
+ <mkdir dir="${results.dir}/ajdt-workspace-root/${target.application.name}/base"/>
+ <antcall target="copy.source.files">
+ <param name="todir" value="${results.dir}/ajdt-workspace-root/${target.application.name}/base"/>
+ </antcall>
+ </target>
+
+ <target name="ajdt.compile" depends="prepare-project">
+
+ <java classname="org.aspectj.systemtest.incremental.tools.AjdeInteractionTestbedLauncher"
+ fork="true"
+ maxmemory="${ajc.maxmem}">
+ <arg value="${results.dir}/ajdt-workspace-root"/>
+ <arg value="${target.application.name}"/>
+ <jvmarg value="${gc.args}"/>
+ <jvmarg value="${hprof.args}"/>
+ <classpath>
+ <path refid="iajc.class.path"/>
+ <path refid="ajde.launch.path"/>
+ <pathelement location="${aspectj.lib.dir}/aspectjrt.jar"/>
+ </classpath>
+ </java>
+
+ <tstamp>
+ <format property="ajdt.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
+ </tstamp>
+ <property name="ajdt.hprof.out" value="${results.dir}/${target.application.name}/ajdt.java.hprof.${ajdt.runtime}.txt"/>
+ <property name="ajdt.gc.out" value="${results.dir}/${target.application.name}/ajdt.gc.${ajdt.runtime}.txt"/>
+ <move file="java.hprof.txt" tofile="${ajdt.hprof.out}"/>
+ <move file="gc.txt" tofile="${ajdt.gc.out}"/>
+ <echo message="hprof data written to ${ajdt.hprof.out}"/>
+ <echo message="gc data written to ${ajdt.gc.out}"/>
+ <echo message="analyse with e.g. HATS and JTune"/>
+
+ </target>
+
+ <target name="ajdt.compile.gc" depends="prepare-project">
+ <tstamp>
+ <format property="ajdt.starttime" pattern="HH:mm:ss"/>
+ </tstamp>
+ <echo message="AJDT started at: ${ajdt.starttime}"/>
+
+ <java classname="org.aspectj.systemtest.incremental.tools.AjdeInteractionTestbedLauncher"
+ fork="true"
+ maxmemory="${ajc.maxmem}">
+ <arg value="${results.dir}/ajdt-workspace-root"/>
+ <arg value="${target.application.name}"/>
+ <jvmarg value="${gc.args}"/>
+ <classpath>
+ <path refid="iajc.class.path"/>
+ <path refid="ajde.launch.path"/>
+ <pathelement location="${aspectj.lib.dir}/aspectjrt.jar"/>
+ </classpath>
+ </java>
+
+ <tstamp>
+ <format property="ajdt.endtime" pattern="HH:mm:ss"/>
+ </tstamp>
+ <echo message="AJDT ended at: ${ajdt.endtime} (started at ${ajdt.starttime})"/>
+ <tstamp>
+ <format property="ajdt.gc.only.runtime" pattern="yyyy-MM-dd'T'HHmmss"/>
+ </tstamp>
+ <property name="ajdt.gc.only.out" value="${results.dir}/${target.application.name}/ajdt.gc.${ajdt.gc.only.runtime}.txt"/>
+ <move file="gc.txt" tofile="${ajdt.gc.only.out}"/>
+ <echo message="gc data written to ${ajdt.gc.only.out}"/>
+ <echo message="analyze with JTune"/>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$1$Args.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$1$Args.class
new file mode 100644
index 000000000..9d20df98b
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$1$Args.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$1.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$1.class
new file mode 100644
index 000000000..7a5eb7520
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$1.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$2.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$2.class
new file mode 100644
index 000000000..ad3a1e453
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$2.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$AntMessageHandler.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$AntMessageHandler.class
new file mode 100644
index 000000000..9528a5f2c
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$AntMessageHandler.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$GuardedCommand.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$GuardedCommand.class
new file mode 100644
index 000000000..b0f916d5c
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask$GuardedCommand.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask.class
new file mode 100644
index 000000000..21d62cd63
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTask.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$1.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$1.class
new file mode 100644
index 000000000..8bd8fbb87
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$1.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$Holder.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$Holder.class
new file mode 100644
index 000000000..cbe75befc
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$Holder.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$InfoHolder.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$InfoHolder.class
new file mode 100644
index 000000000..2c97a56e6
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$InfoHolder.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$MessageHolderChecker.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$MessageHolderChecker.class
new file mode 100644
index 000000000..db9a389b9
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest$MessageHolderChecker.class
Binary files differ
diff --git a/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest.class b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest.class
new file mode 100644
index 000000000..fb012d2da
--- /dev/null
+++ b/tests/profiling/classes/org/aspectj/tools/ant/taskdefs/AjcTaskTest.class
Binary files differ
diff --git a/tests/profiling/classes/readme.txt b/tests/profiling/classes/readme.txt
new file mode 100644
index 000000000..b4e8b35e7
--- /dev/null
+++ b/tests/profiling/classes/readme.txt
@@ -0,0 +1,6 @@
+This folder contains a copy of AjcTask from the AspectJ 1.5.1 tree.
+It is put on the classpath ahead of aspectjtools.jar when the
+property use.local.iajc.task.class is set to true (default = true).
+You need this if you want to profile released versions of aspectj
+prior to 1.5.1 in order for the <jvmarg> property that the profiler
+needs to be supported. \ No newline at end of file
diff --git a/tests/profiling/ltw-app/META-INF/aop.xml b/tests/profiling/ltw-app/META-INF/aop.xml
new file mode 100644
index 000000000..782ed75ca
--- /dev/null
+++ b/tests/profiling/ltw-app/META-INF/aop.xml
@@ -0,0 +1,5 @@
+<aspectj>
+ <weaver>
+ <include within="org.springframework..*"/>
+ </weaver>
+</aspectj> \ No newline at end of file
diff --git a/tests/profiling/ltw-app/src/org/aspectj/profiling/LTWApp.java b/tests/profiling/ltw-app/src/org/aspectj/profiling/LTWApp.java
new file mode 100644
index 000000000..a247fb10b
--- /dev/null
+++ b/tests/profiling/ltw-app/src/org/aspectj/profiling/LTWApp.java
@@ -0,0 +1,74 @@
+/* *******************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.profiling;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/**
+ * Application that takes a single argument containing the name of a
+ * jar file, and performs Class.forName on every class within it.
+ */
+public class LTWApp {
+
+ private File inJar;
+ private int numLoaded = 0;
+
+ public static void main(String[] args) throws IOException {
+ if (args.length != 1) {
+ throw new IllegalArgumentException("Expecting a single jar file argument");
+ }
+ new LTWApp(args[0]).run();
+ }
+
+ public LTWApp(String jarFileName) {
+ inJar = new File(jarFileName);
+ if (!inJar.exists() || !inJar.canRead()) {
+ throw new IllegalArgumentException("File '" + jarFileName +
+ "' does not exist or cannot be read");
+ }
+ }
+
+ public void run() throws IOException {
+ ZipInputStream inStream = new ZipInputStream(new FileInputStream(inJar));
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ ZipEntry entry = inStream.getNextEntry();
+ if (entry == null) break;
+
+ if (entry.isDirectory() || !entry.getName().endsWith(".class")) {
+ continue;
+ }
+
+ loadClass(entry.getName());
+ }
+ long endTime = System.currentTimeMillis();
+ System.out.println("Loaded " + numLoaded + " classes in " + (endTime - startTime) + " milliseconds");
+ }
+
+ private void loadClass(String classFileName) {
+ String className = classFileName.substring(0,(classFileName.length() - ".class".length()));
+ className = className.replace('/','.');
+ try {
+ Class c = Class.forName(className);
+ }
+ catch(ClassNotFoundException ex) {
+ throw new IllegalStateException("Unable to load class defined in input jar file, check that jar is also on the classpath!");
+ }
+ numLoaded++;
+ }
+} \ No newline at end of file
diff --git a/tests/profiling/readme.txt b/tests/profiling/readme.txt
new file mode 100644
index 000000000..0aa179285
--- /dev/null
+++ b/tests/profiling/readme.txt
@@ -0,0 +1,8 @@
+This folder contains an ant build script and supporting resources
+that can be used for profiling the aspectj compiler and getting
+information about memory usage and compilation time.
+
+"ant usage" will display usage information.
+
+Reports of historical interest (for tracking improvements across releases
+for example) are kept in the reference-data sub-folder.
diff --git a/tests/profiling/spring-1.2.6.xml b/tests/profiling/spring-1.2.6.xml
new file mode 100644
index 000000000..868ae4287
--- /dev/null
+++ b/tests/profiling/spring-1.2.6.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2006 contributors.
+
+ All rights reserved.
+ This program and the accompanying materials are made available
+ under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution and is available at
+ http://eclipse.org/legal/epl-v10.html
+
+ Contributors: Adrian Colyer
+-->
+
+<project name="spring-1.2.6" default="spring-1.2.6-usage">
+
+ <!-- imported by master build.xml when using the springframework 1.2.6
+ source tree as the basis for profiling the compiler -->
+
+ <target name="spring-1.2.6-usage">
+ <echo message="this file contains only path definitions"/>
+ <echo message="these are used to customize the target application used by"/>
+ <echo message="the profiling tests. Set the target.application.definitions.file"/>
+ <echo message="property to point to your own replacement of this file to"/>
+ <echo message="profile compilation of an alternate project"/>
+ </target>
+
+ <!-- any target.application.definitions.file must define the following paths:
+ * source.roots (used for from source and ajdt compilation tests)
+ * build.class.path (the class path needed to build the application)
+ it must also define the copy.source.files target needed by the ajdt build
+ -->
+
+ <!-- the source roots used for compilation. -->
+ <path id="source.roots">
+ <pathelement location="${spring.install.dir}/src"/>
+ <pathelement location="${spring.install.dir}/tiger/src"/>
+ <pathelement location="${test.aspects.src.dir}"/>
+ </path>
+
+ <!-- the classpath needed for compilation -->
+ <path id="build.class.path">
+ <fileset dir="${spring.install.dir}">
+ <include name="**/*.jar"/>
+ <exclude name="aspectj/*.jar"/>
+ </fileset>
+ </path>
+
+ <!-- the source files used for AJDT project-based compilation -->
+ <target name="copy.source.files" depends="init">
+ <echo message="copying source files to ${todir}"/>
+ <copy todir="${todir}">
+ <fileset dir="${spring.install.dir}/src"
+ includes="**/*.java,**/*.aj"/>
+ <fileset dir="${spring.install.dir}/tiger/src"
+ includes="**/*.java,**/*.aj"/>
+ <fileset dir="${test.aspects.src.dir}"
+ includes="**/*.java,**/*.aj"/>
+ </copy>
+ </target>
+
+</project> \ No newline at end of file