I originally sent this mail last Thursday, but it seems to have got lost
somewhere along the way ...


-----Original Message-----
From: Summerwill, Bob [mailto:[EMAIL PROTECTED]
Sent: 27 September 2001 18:23
To: [EMAIL PROTECTED]
Subject: Task to time parts of the build


I've written a task called "Timed" which can be used to time parts of the
build.  This is a trivial subclass of Sequential.  I've written this as
a new core task, though maybe it should be an optional task.

I attach the .java source file and HTML documentation.  As well as the
new files, there are these one-liners ...

---------------------------------------------------------------
docs/manual/coretasklist.html
---------------------------------------------------------------
<a href="CoreTasks/timed.html">Timed</a><br>
---------------------------------------------------------------

---------------------------------------------------------------
src/main/org/apache/tools/ant/taskdefs/defaults.properties
---------------------------------------------------------------
timed=org.apache.tools.ant.taskdefs.Timed
---------------------------------------------------------------


Cheers,
Bob Summerwill
Electronic Arts UK


PS.  Sorry they're not diffs - I'm behind a firewall, and CVS access to
the Ant server is blocked at the moment.


-----Original Message-----
From: Summerwill, Bob [mailto:[EMAIL PROTECTED]
Sent: 27 September 2001 14:57
To: [email protected]
Subject: RE: Timing parts of the build.



I've written a new task to implement this, called Timed.  This is a
trivial subclass of Sequential.  I've written this as a new core task,
though maybe it should be optional.

How should I submit this task to the project?  There's a new .java file,
the matching HTML documentation, and modifications to coretasklist.html
and default.properties.  Should I just send a [PATCH] e-mail to
the ant-dev mailing list, containing the new code inline, with diffs
for the changed files, and a brief explanation?


Cheers,
Bob

-----Original Message-----
From: Erik Hatcher [mailto:[EMAIL PROTECTED]
Sent: 10 September 2001 13:24
To: [email protected]
Subject: Re: Timing parts of the build.


You could create a task similar to Sequential that implements TaskContainer
and have it do this pretty easily.   It would give you the capability of
timing tasks all within a target, not across targets.  Actually it might be
cleaner to just patch Sequential.java to do it automatically and avoid two
"sequential" tasks out there.    It seems like it'd only take a few lines of
code.

    Erik


----- Original Message -----
From: "Summerwill, Bob" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, September 10, 2001 4:30 AM
Subject: Timing parts of the build.


> Has anyone got any recommendations on timing parts an Ant build?  I'd like
> to be able to place the timing for part of the build in a Ant property, so
> it can be used in XSLT transforms, etc.
>
>
> Pseudocode ....
>
>
>
> <target name="example">
>
>      <timedSection name="build.time">
>          <!-- do some part of the build, which generates a log file. -->
>      </timedSection>
>
>      <!-- Add the timing information to the build log. -->
>      <style in="buildLog.xml" out="timedBuildLog.xml"
> style="addTimingInfo.xsl">
>          <param name="howLongItTook" value="${build.time}"/>
>      </style>
>
> </target>
>
>
> Is timing information available?  Is there a simple way to do something
> similar?
>
>
> Cheers,
> Bob
>


Attachment: Timed.java
Description: Binary data

Title: Ant User Manual

Timed

Description

Timed is a container task - it can contain other Ant tasks. It is a specialized version of sequential, which times the tasks which it contains. Like sequential, the nested tasks are executed in sequence. The timing information is in seconds.

Parameters

Attribute Description Required
property destination property for the timing. Yes

The timed task has a single compulsory attribute, which identifies the property which the elapsed time will be stored in. Any valid Ant task may be embedded within the timed task.

Example

<timed property="time.elapsed">
  <junit ...>
</timed>
<echo message="JUnit took ${time.elapsed} seconds">

Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.

Reply via email to