You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by li...@bitfaeule.net on 2004/09/27 15:28:03 UTC
measuring performance of a task
Hello,
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.
Thank you
jacques
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: measuring performance of a task
Posted by Laconia Data Systems <we...@laconiadatasystems.com>.
Jacques-
I would start by echoing <tstamp> into your logfile before task executuion
and after a task completion
HTH,
Martin-
----- Original Message -----
From: <li...@bitfaeule.net>
To: <us...@ant.apache.org>
Sent: Monday, September 27, 2004 9:28 AM
Subject: measuring performance of a task
>
> Hello,
>
> 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.
>
> Thank you
>
> jacques
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: measuring performance of a task
Posted by Wascally Wabbit <wa...@earthling.net>.
Ant-contrib's <stopwatch> can help you do this easily, like:
<target name="MyTarget">
<stopwatch name="MyTarget.time" action="start"/>
[work work work]
<stopwatch name="MyTarget.time" action="total"/>
<echo message="It Took: ${MyTarget.time}" file="MyLogs.log".../>
</target>
At 09:28 AM 9/27/2004, you wrote:
>Hello,
>
>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.
>
>Thank you
>
>jacques
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
The Wabbit
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: measuring performance of a task
Posted by Nicolas Mailhot <Ni...@laPoste.net>.
Le lundi 27 septembre 2004 à 15:49 +0200, Stephen McConnell a écrit :
>
> > -----Original Message-----
> > From: lists@bitfaeule.net [mailto:lists@bitfaeule.net]
> > Sent: 27 September 2004 15:28
> > To: user@ant.apache.org
> > Subject: measuring performance of a task
> >
> >
> > Hello,
> >
> > 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 org.apache.tools.ant 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 );
Another (very crude) way :
<tstamp>
<format pattern="HH:mm.ss" property="foo.start"/>
</tstamp>
do something ...
<tstamp>
<format pattern="HH:mm.ss" property="foo.stop"/>
</tstamp>
<echo level="info" message="Run time (foo): ${foo.start} to
${foo.stop}"/>
This depends of course of what you need to achieve exactly
Regards,
--
Nicolas Mailhot
RE: measuring performance of a task
Posted by Stephen McConnell <mc...@apache.org>.
> -----Original Message-----
> From: lists@bitfaeule.net [mailto:lists@bitfaeule.net]
> Sent: 27 September 2004 15:28
> To: user@ant.apache.org
> Subject: measuring performance of a task
>
>
> Hello,
>
> 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 org.apache.tools.ant 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 );
Cheers, Steve,
>
> Thank you
>
> jacques
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org