ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Re: RE: measuring performance of a task
Date Mon, 27 Sep 2004 14:16:09 GMT

On Sep 27, 2004, at 15:49, Stephen McConnell wrote:

I would like to automatically measure the time ant spends executing a
task and write it to my logfile.

What's the best way to do that? I would like to avoid writing a custom
task in Java.

I guess you could create a build listener.  Using the events posted to
the listener I think you can capture the start and end of task execution
based on task name or target name.  The interface to look at is
BuildListener which is the package.  Once you have
created an implementation of this interface you can register it with
your project using something like:

   BuildListener listener = new MyBuildListener();
   getProject().addBuildListener( listener );

Thank you. This is what I have in mind.. Is ther example code for making
a listener?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message