Package net.sf.antcontrib.perf
Class AntPerformanceListener
- java.lang.Object
-
- net.sf.antcontrib.perf.AntPerformanceListener
-
- All Implemented Interfaces:
java.util.EventListener
,org.apache.tools.ant.BuildListener
public class AntPerformanceListener extends java.lang.Object implements org.apache.tools.ant.BuildListener
This BuildListener keeps track of the total time it takes for each target and task to execute, then prints out the totals when the build is finished. This can help pinpoint the areas where a build is taking a lot of time so optimization efforts can focus where they'll do the most good. Execution times are grouped by targets and tasks, and are sorted from fastest running to slowest running. Output can be saved to a file by setting a property in Ant. Set "performance.log" to the name of a file. This can be set either on the command line with the -D option (-Dperformance.log=/tmp/performance.log) or in the build file itself (). Developed for use with Antelope, migrated to ant-contrib Oct 2003.
- Version:
- $Revision: 1.5 $
- Author:
- Dale Anson, danson@germane-software.com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AntPerformanceListener.StopWatch
A stopwatch, useful for 'quick and dirty' performance testing.class
AntPerformanceListener.StopWatchComparator
Compares the total times for two StopWatches.
-
Constructor Summary
Constructors Constructor Description AntPerformanceListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildFinished(org.apache.tools.ant.BuildEvent be)
Sorts and prints the results.void
buildStarted(org.apache.tools.ant.BuildEvent be)
Starts a 'running total' stopwatch.static void
main(java.lang.String[] args)
void
messageLogged(org.apache.tools.ant.BuildEvent be)
no-opvoid
targetFinished(org.apache.tools.ant.BuildEvent be)
Stop timing the given target.void
targetStarted(org.apache.tools.ant.BuildEvent be)
Start timing the given target.void
taskFinished(org.apache.tools.ant.BuildEvent be)
Stop timing the given task.void
taskStarted(org.apache.tools.ant.BuildEvent be)
Start timing the given task.
-
-
-
Method Detail
-
buildStarted
public void buildStarted(org.apache.tools.ant.BuildEvent be)
Starts a 'running total' stopwatch.- Specified by:
buildStarted
in interfaceorg.apache.tools.ant.BuildListener
-
buildFinished
public void buildFinished(org.apache.tools.ant.BuildEvent be)
Sorts and prints the results.- Specified by:
buildFinished
in interfaceorg.apache.tools.ant.BuildListener
-
targetStarted
public void targetStarted(org.apache.tools.ant.BuildEvent be)
Start timing the given target.- Specified by:
targetStarted
in interfaceorg.apache.tools.ant.BuildListener
-
targetFinished
public void targetFinished(org.apache.tools.ant.BuildEvent be)
Stop timing the given target.- Specified by:
targetFinished
in interfaceorg.apache.tools.ant.BuildListener
-
taskStarted
public void taskStarted(org.apache.tools.ant.BuildEvent be)
Start timing the given task.- Specified by:
taskStarted
in interfaceorg.apache.tools.ant.BuildListener
-
taskFinished
public void taskFinished(org.apache.tools.ant.BuildEvent be)
Stop timing the given task.- Specified by:
taskFinished
in interfaceorg.apache.tools.ant.BuildListener
-
messageLogged
public void messageLogged(org.apache.tools.ant.BuildEvent be)
no-op- Specified by:
messageLogged
in interfaceorg.apache.tools.ant.BuildListener
-
main
public static void main(java.lang.String[] args)
-
-