There seems to be a problem using the timer task inside ANT v1.6 compliant targets. Watch out for an updated version of the timer task which will be issued soon.
Extend Ant to measure amount of time elapsed to complete a build task.
The task now supports the high resolution timer (accessed by nanoTime
)
introduced by Java 1.5.
If present it will be used automatically otherwise the classical currentTimeMillis
will be used.
Note: The task will no longer compile using a JDK prior to version 1.5.
If you intend to run it under JRE 1.4 or earlier download the JAR archive.
<taskdef name="timer" classname="de.jeckle.AntExtension.Timer"/>
verbose
attribute switches the verbose mode on if it contains the value true
.
Additionally, the timer task can be named by the name
attribute.timer
tasks.
|
<target name="test">
<timer verbose="true">
<echo>test1</echo>
</timer>
<timer name="timer2">
<echo>test2</echo>
<timer name="timer3" verbose="true">
<echo>test3</echo>
</timer>
<echo>test4</echo>
</timer>
</target>
Buildfile: build.xml
test:
[timer] System reports java version 1.5.0-beta
[timer] Using high resolution timer
[timer] started [echo] test1
[timer] elapsed time: 0 ms
[echo] test2
[timer] named timer3 started
[echo] test3
[timer] elapsed time for executing task named timer3: 2 minute(s) 7 second(s) 762 millisecond(s) 818327 nannosecond(s)
[echo] test4
[timer] elapsed time for executing task named timer2: 1 minute(s) 9 second(s) 235 millisecond(s) 593192 nannosecond(s)
BUILD SUCCESSFUL
Total time: 1 second
The implementation is released unter the Lesser GNU Public License.
Service provided by Mario Jeckle
Generated: 2004-06-11T07:11:41+01:00
Feedback SiteMap
This page's original location: http://www.jeckle.de/freeStuff/AntTimerTask/index.html
RDF description for this page