net.sf.antcontrib.perf

Class AntPerformanceListener

Implemented Interfaces:
BuildListener

public class AntPerformanceListener
extends java.lang.Object
implements 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.3 $
Author:
Dale Anson, danson@germane-software.com

Nested Class Summary

class
AntPerformanceListener.StopWatch
A stopwatch, useful for 'quick and dirty' performance testing.
class
AntPerformanceListener.StopWatchComparator
Compares the total times for two StopWatches.

Method Summary

void
buildFinished(BuildEvent be)
Sorts and prints the results.
void
buildStarted(BuildEvent be)
Starts a 'running total' stopwatch.
static void
main(String[] args)
void
messageLogged(BuildEvent be)
no-op
void
targetFinished(BuildEvent be)
Stop timing the given target.
void
targetStarted(BuildEvent be)
Start timing the given target.
void
taskFinished(BuildEvent be)
Stop timing the given task.
void
taskStarted(BuildEvent be)
Start timing the given task.

Method Details

buildFinished

public void buildFinished(BuildEvent be)
Sorts and prints the results.

buildStarted

public void buildStarted(BuildEvent be)
Starts a 'running total' stopwatch.

main

public static void main(String[] args)

messageLogged

public void messageLogged(BuildEvent be)
no-op

targetFinished

public void targetFinished(BuildEvent be)
Stop timing the given target.

targetStarted

public void targetStarted(BuildEvent be)
Start timing the given target.

taskFinished

public void taskFinished(BuildEvent be)
Stop timing the given task.

taskStarted

public void taskStarted(BuildEvent be)
Start timing the given task.