You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by dkhanna01 <dk...@yahoo.co.in> on 2007/08/01 17:44:09 UTC
Re: TImestamping in ANT
HI,
I tried with net.sf.antcontrib.perf.AntPerformanceListener but every time I
create a build it failed saying
java.lang.OutOfMemoryError: Java heap space
Java heap space
This happens abruptly at any place during cmpile time. Now the same build is
running fine with ANT 1.6.1 and without using listener.
I have updated ANT 1.7.0 and used antcontrib listener and that is where its
failing. Now I also tried creating the build with ANT 1.7.0 version without
listner and it did worked. Also java version was same at all the places. SO
I am assuming that there is some problem in using this listner
I think Antelope could be a good option but the question is where I can
download ANTELOPE ? I couldn't find it on the web site you mentioned.
Please Help !
THanks
Dale Anson wrote:
>
> Another option for this is to use either the stopwatch task or the
> performance listener from either antcontrib
> (antcontribe.sourceforge.net) or antelope (antelope.tigris.org). The
> performance listener is actually quite nice in that it gathers the
> statistics as the build runs, then outputs the stats altogether at the
> end of the build. I put some example output below, see the docs at
> http://antelope.tigris.org/nonav/docs/manual/bk03ch27.html
>
> Dale
>
>
>
> Output in the target results shows the build file name followed by the
> target name, output in the task results shows the build filename
> followed by the target name followed by the task name.
>
> -------------- Target Results -----------------------
> Antelope.all: 0.000 sec
> Antelope.init: 0.011 sec
> Antelope.-build_number: 0.014 sec
> Antelope.clean: 0.233 sec
> Antelope.-zip_tasks: 0.297 sec
> Antelope.prep_files: 0.311 sec
> Antelope.-zip_docs: 0.546 sec
> Antelope.combined: 1.290 sec
> Antelope.compile: 1.724 sec
> Antelope.dist: 2.162 sec
>
> -------------- Task Results -----------------------
> Antelope.init.mkdir: 0.000 sec
> Antelope.init.mkdir: 0.001 sec
> Antelope.dist.echo: 0.002 sec
> Antelope.prep_files.delete: 0.004 sec
> Antelope.combined.echo: 0.005 sec
> Antelope.dist.delete: 0.006 sec
> Antelope.-zip_tasks.echo: 0.007 sec
> Antelope.dist.copy: 0.011 sec
> Antelope.-build_number.buildnumber: 0.014 sec
> Antelope.compile.copy: 0.016 sec
> Antelope.prep_files.copy: 0.020 sec
> Antelope.prep_files.replace: 0.071 sec
> Antelope.-zip_tasks.zip: 0.122 sec
> Antelope.-zip_tasks.jar: 0.161 sec
> Antelope.prep_files.replace: 0.216 sec
> Antelope.clean.delete: 0.233 sec
> Antelope.dist.antcall: 0.421 sec
> Antelope.-zip_docs.zip: 0.540 sec
> Antelope.dist.antcall: 0.685 sec
> Antelope.dist.zip: 1.036 sec
> Antelope.combined.jar: 1.284 sec
> Antelope.compile.javac: 1.708 sec
>
> -------------- Totals -----------------------
> Start time: Thu, 5 Dec 2002 17:18:30
> Stop time: Thu, 5 Dec 2002 17:18:39
> Total time: 8.476 sec
>
>
> Woot! The example is almost 5 years old and still valid!
>
>
>
> Wascally Wabbit wrote:
>> Sorry,
>> Incomplete original example methinks.
>>
>> If you change
>> - <assign var="time" value="now"/>
>>
>> to
>> + <assign var="time" op="-now" fromvar="time"/>
>>
>> it should work.
>>
>> --- [ A WORKING EXAMPLE TO DEMONSTRATE (TESTED ;-))] ----
>>
>> Here's a working sample (assuming AntX is installed in a
>> directory at ./antx relative to test script):
>>
>> <project name="test" default="timed-target" basedir=".">
>> <property name="jware.antx.defaults.valueuris.flag" value="yes"/>
>> <path id="antx.classpath">
>> <pathelement location="${basedir}/antx/JWare_apis.jar"/>
>> <pathelement location="${basedir}/antx/AntX_tasks.jar"/>
>> </path>
>>
>> <taskdef resource="com/idaremedia/antx/install/antlib.xml"
>> classpathref="antx.classpath"/>
>> <typedef resource="com/idaremedia/antx/valueuri/antlib.xml"
>> classpathref="antx.classpath"/>
>>
>> <target name="timed-target">
>> <assign var="time" op="now"/>
>> <echo message="started @ ${$var:time} ms"/>
>> <sleep seconds="2"/>
>> <assign var="time" op="-now" fromvar="time"/>
>> <echo message="duration was ${$var:time} ms"/>
>> <copyproperty name="duration" variable="time"
>> transform="duration"/>
>> <echo message="Duration transformed is ${duration}"/>
>> </target>
>> </project>
>>
>>
>> OUTPUT:
>> timed-target:
>> [echo] started @ 1185500881950 ms
>> [echo] duration was 2003 ms
>> [echo] Duration transformed is 2sec.3ms
>>
>>
>> dkhanna01 wrote:
>>> first of all thanks for the information
>>> I tried to load antx libraries and it did worked, BUT while
>>> calculating the
>>> duration its giving me an error as :
>>>
>>> Unable to convert 'now' to time duration.
>>> compile took -now
>>>
>>> Here is my code:
>>>
>>> <target name="usage" description="Displays a list of valid targets">
>>> <assign var="time" value="now"/>
>>> <copyproperty name="usage.start" variable="time"
>>> transform="datetime"/>
>>> <echo level="info" message="usage started ${usage.start}"/>
>>>
>>> <antcall target="usage:default"/>
>>>
>>> <assign var="time" value="now"/>
>>> <copyproperty name="compile.duration" variable="time"
>>> transform="duration"/>
>>>
>>> <echo level="info" message="compile took ${compile.duration}"/>
>>> </target>
>>>
>>> Is there any thing I have missed.
>>>
>>> THanks again
>>>
>>>
>>>
>>>
>>> Wascally Wabbit wrote:
>>>> Hi,
>>>>
>>>> The assign task is already defined for you as part of the
>>>> AntXtras antlib. The easiest thing to do is to load the
>>>> entire antlib and experiment. *See the Quick Start and
>>>> User Guide for additional information*.
>>>>
>>>> Example (assuming at least Ant 1.6.5, and AntXtras bin download
>>>> to some local directory '${antextensions.d}/antx'):
>>>>
>>>> [Top-Level]
>>>>
>>>> <path id="antx.classpath">
>>>> <fileset dir="${antextensions.d}/antx">
>>>> <include name="lib/*.jar"/>
>>>> </fileset>
>>>> </path>
>>>>
>>>> <taskdef resource="com/idaremedia/antx/install/antlib.xml"
>>>> classpathref="antx.classpath"/>
>>>>
>>>>
>>>> [In any target or macrodef]
>>>> <assign var="duration" value="now"/>
>>>> ...
>>>> <assign var="duration" value="-now" .../>
>>>> ...
>>>>
>>>> -The Wabbit
>>>>
>>>>
>>>> dkhanna01 wrote:
>>>>> Hi I downloaded the antxtras unility from the site but the two jar
>>>>> files in
>>>>> that does not contain class file for assign task. SO when I try to
>>>>> run my
>>>>> script after adding assing task it gave an error that " Problem:
>>>>> failed
>>>>> to
>>>>> create task or type assign"
>>>>>
>>>>> THanks
>>>>>
>>>>>
>>>>> Wascally Wabbit wrote:
>>>>>> dkhanna01 wrote:
>>>>>>> I need to find out the time taken by each of the process/target
>>>>>>> in our
>>>>>>> build.xml file. Now for doing this I have use ANT tstamp task to
>>>>>>> calculate
>>>>>>> the start time and end time of the process. Now my question is
>>>>>>> how do I
>>>>>>> find
>>>>>>> out the total time taken by the process, I mean is there any way to
>>>>>>> calculate difference between "End time" and "Start time"
>>>>>>> Thanks
>>>>>> If you can use thirdparty libraries you can use the AntXtra's
>>>>>> <assign> task like so:
>>>>>>
>>>>>> <target name="compile" depends="-init" description="Compile stuff">
>>>>>> <assign var="time" value="now"/>
>>>>>> ...[all your compiling tasks here]
>>>>>> <assign var="time" value="-now" transform="duration"
>>>>>> copyproperty="compile.duration"/>
>>>>>> <echo level="info" message="compile took ${compile.duration}"/>
>>>>>> </target>
>>>>>>
>>>>>> If you want to do this for lots of your targets you can leverage
>>>>>> macrodefs to do this for every target using something like:
>>>>>>
>>>>>> <macrodef name="timedtarget">
>>>>>> <attribute name="name">
>>>>>> <attribute name="functions"/>
>>>>>> <sequential>
>>>>>> <assign var="time_" value="now"/>
>>>>>> <callinline targets="@{functions}"/> <!--do NOT switch
>>>>>> projects-->
>>>>>> <assign var="time_" value="-now" transform="duration"
>>>>>> copyproperty="@{name}.duration"/>
>>>>>> <echo level="info" message="@{name} took ${@{name}.duration}"/>
>>>>>> </sequential>
>>>>>> </macrodef>
>>>>>>
>>>>>> Then use it like so:
>>>>>>
>>>>>> <target name="-compile">
>>>>>> ...[all your compiling work here in private target]
>>>>>> </target>
>>>>>>
>>>>>> <target name="compile" depends="-init" description="Compile stuff">
>>>>>> <timetarget name="compile" functions="-compile"/>
>>>>>> </target>
>>>>>>
>>>>>> AntXtras is at: http://antxtras.sf.net/
>>>>>>
>>>>>> Hope that helps.
>>>>>>
>>>>>> -The Wabbit
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>>
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
View this message in context: http://www.nabble.com/TImestamping-in-ANT-tf4050746.html#a11948152
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: TImestamping in ANT
Posted by Dale Anson <da...@grafidog.com>.
The Antelope downloads are here:
http://antelope.tigris.org/servlets/ProjectDocumentList
However
dkhanna01 wrote:
> HI,
>
> I tried with net.sf.antcontrib.perf.AntPerformanceListener but every time I
> create a build it failed saying
>
> java.lang.OutOfMemoryError: Java heap space
> Java heap space
>
> This happens abruptly at any place during cmpile time. Now the same build is
> running fine with ANT 1.6.1 and without using listener.
>
> I have updated ANT 1.7.0 and used antcontrib listener and that is where its
> failing. Now I also tried creating the build with ANT 1.7.0 version without
> listner and it did worked. Also java version was same at all the places. SO
> I am assuming that there is some problem in using this listner
>
> I think Antelope could be a good option but the question is where I can
> download ANTELOPE ? I couldn't find it on the web site you mentioned.
>
> Please Help !
>
> THanks
>
>
>
>
> Dale Anson wrote:
>
>> Another option for this is to use either the stopwatch task or the
>> performance listener from either antcontrib
>> (antcontribe.sourceforge.net) or antelope (antelope.tigris.org). The
>> performance listener is actually quite nice in that it gathers the
>> statistics as the build runs, then outputs the stats altogether at the
>> end of the build. I put some example output below, see the docs at
>> http://antelope.tigris.org/nonav/docs/manual/bk03ch27.html
>>
>> Dale
>>
>>
>>
>> Output in the target results shows the build file name followed by the
>> target name, output in the task results shows the build filename
>> followed by the target name followed by the task name.
>>
>> -------------- Target Results -----------------------
>> Antelope.all: 0.000 sec
>> Antelope.init: 0.011 sec
>> Antelope.-build_number: 0.014 sec
>> Antelope.clean: 0.233 sec
>> Antelope.-zip_tasks: 0.297 sec
>> Antelope.prep_files: 0.311 sec
>> Antelope.-zip_docs: 0.546 sec
>> Antelope.combined: 1.290 sec
>> Antelope.compile: 1.724 sec
>> Antelope.dist: 2.162 sec
>>
>> -------------- Task Results -----------------------
>> Antelope.init.mkdir: 0.000 sec
>> Antelope.init.mkdir: 0.001 sec
>> Antelope.dist.echo: 0.002 sec
>> Antelope.prep_files.delete: 0.004 sec
>> Antelope.combined.echo: 0.005 sec
>> Antelope.dist.delete: 0.006 sec
>> Antelope.-zip_tasks.echo: 0.007 sec
>> Antelope.dist.copy: 0.011 sec
>> Antelope.-build_number.buildnumber: 0.014 sec
>> Antelope.compile.copy: 0.016 sec
>> Antelope.prep_files.copy: 0.020 sec
>> Antelope.prep_files.replace: 0.071 sec
>> Antelope.-zip_tasks.zip: 0.122 sec
>> Antelope.-zip_tasks.jar: 0.161 sec
>> Antelope.prep_files.replace: 0.216 sec
>> Antelope.clean.delete: 0.233 sec
>> Antelope.dist.antcall: 0.421 sec
>> Antelope.-zip_docs.zip: 0.540 sec
>> Antelope.dist.antcall: 0.685 sec
>> Antelope.dist.zip: 1.036 sec
>> Antelope.combined.jar: 1.284 sec
>> Antelope.compile.javac: 1.708 sec
>>
>> -------------- Totals -----------------------
>> Start time: Thu, 5 Dec 2002 17:18:30
>> Stop time: Thu, 5 Dec 2002 17:18:39
>> Total time: 8.476 sec
>>
>>
>> Woot! The example is almost 5 years old and still valid!
>>
>>
>>
>> Wascally Wabbit wrote:
>>
>>> Sorry,
>>> Incomplete original example methinks.
>>>
>>> If you change
>>> - <assign var="time" value="now"/>
>>>
>>> to
>>> + <assign var="time" op="-now" fromvar="time"/>
>>>
>>> it should work.
>>>
>>> --- [ A WORKING EXAMPLE TO DEMONSTRATE (TESTED ;-))] ----
>>>
>>> Here's a working sample (assuming AntX is installed in a
>>> directory at ./antx relative to test script):
>>>
>>> <project name="test" default="timed-target" basedir=".">
>>> <property name="jware.antx.defaults.valueuris.flag" value="yes"/>
>>> <path id="antx.classpath">
>>> <pathelement location="${basedir}/antx/JWare_apis.jar"/>
>>> <pathelement location="${basedir}/antx/AntX_tasks.jar"/>
>>> </path>
>>>
>>> <taskdef resource="com/idaremedia/antx/install/antlib.xml"
>>> classpathref="antx.classpath"/>
>>> <typedef resource="com/idaremedia/antx/valueuri/antlib.xml"
>>> classpathref="antx.classpath"/>
>>>
>>> <target name="timed-target">
>>> <assign var="time" op="now"/>
>>> <echo message="started @ ${$var:time} ms"/>
>>> <sleep seconds="2"/>
>>> <assign var="time" op="-now" fromvar="time"/>
>>> <echo message="duration was ${$var:time} ms"/>
>>> <copyproperty name="duration" variable="time"
>>> transform="duration"/>
>>> <echo message="Duration transformed is ${duration}"/>
>>> </target>
>>> </project>
>>>
>>>
>>> OUTPUT:
>>> timed-target:
>>> [echo] started @ 1185500881950 ms
>>> [echo] duration was 2003 ms
>>> [echo] Duration transformed is 2sec.3ms
>>>
>>>
>>> dkhanna01 wrote:
>>>
>>>> first of all thanks for the information
>>>> I tried to load antx libraries and it did worked, BUT while
>>>> calculating the
>>>> duration its giving me an error as :
>>>>
>>>> Unable to convert 'now' to time duration.
>>>> compile took -now
>>>>
>>>> Here is my code:
>>>>
>>>> <target name="usage" description="Displays a list of valid targets">
>>>> <assign var="time" value="now"/>
>>>> <copyproperty name="usage.start" variable="time"
>>>> transform="datetime"/>
>>>> <echo level="info" message="usage started ${usage.start}"/>
>>>>
>>>> <antcall target="usage:default"/>
>>>>
>>>> <assign var="time" value="now"/>
>>>> <copyproperty name="compile.duration" variable="time"
>>>> transform="duration"/>
>>>>
>>>> <echo level="info" message="compile took ${compile.duration}"/>
>>>> </target>
>>>>
>>>> Is there any thing I have missed.
>>>>
>>>> THanks again
>>>>
>>>>
>>>>
>>>>
>>>> Wascally Wabbit wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> The assign task is already defined for you as part of the
>>>>> AntXtras antlib. The easiest thing to do is to load the
>>>>> entire antlib and experiment. *See the Quick Start and
>>>>> User Guide for additional information*.
>>>>>
>>>>> Example (assuming at least Ant 1.6.5, and AntXtras bin download
>>>>> to some local directory '${antextensions.d}/antx'):
>>>>>
>>>>> [Top-Level]
>>>>>
>>>>> <path id="antx.classpath">
>>>>> <fileset dir="${antextensions.d}/antx">
>>>>> <include name="lib/*.jar"/>
>>>>> </fileset>
>>>>> </path>
>>>>>
>>>>> <taskdef resource="com/idaremedia/antx/install/antlib.xml"
>>>>> classpathref="antx.classpath"/>
>>>>>
>>>>>
>>>>> [In any target or macrodef]
>>>>> <assign var="duration" value="now"/>
>>>>> ...
>>>>> <assign var="duration" value="-now" .../>
>>>>> ...
>>>>>
>>>>> -The Wabbit
>>>>>
>>>>>
>>>>> dkhanna01 wrote:
>>>>>
>>>>>> Hi I downloaded the antxtras unility from the site but the two jar
>>>>>> files in
>>>>>> that does not contain class file for assign task. SO when I try to
>>>>>> run my
>>>>>> script after adding assing task it gave an error that " Problem:
>>>>>> failed
>>>>>> to
>>>>>> create task or type assign"
>>>>>>
>>>>>> THanks
>>>>>>
>>>>>>
>>>>>> Wascally Wabbit wrote:
>>>>>>
>>>>>>> dkhanna01 wrote:
>>>>>>>
>>>>>>>> I need to find out the time taken by each of the process/target
>>>>>>>> in our
>>>>>>>> build.xml file. Now for doing this I have use ANT tstamp task to
>>>>>>>> calculate
>>>>>>>> the start time and end time of the process. Now my question is
>>>>>>>> how do I
>>>>>>>> find
>>>>>>>> out the total time taken by the process, I mean is there any way to
>>>>>>>> calculate difference between "End time" and "Start time"
>>>>>>>> Thanks
>>>>>>>>
>>>>>>> If you can use thirdparty libraries you can use the AntXtra's
>>>>>>> <assign> task like so:
>>>>>>>
>>>>>>> <target name="compile" depends="-init" description="Compile stuff">
>>>>>>> <assign var="time" value="now"/>
>>>>>>> ...[all your compiling tasks here]
>>>>>>> <assign var="time" value="-now" transform="duration"
>>>>>>> copyproperty="compile.duration"/>
>>>>>>> <echo level="info" message="compile took ${compile.duration}"/>
>>>>>>> </target>
>>>>>>>
>>>>>>> If you want to do this for lots of your targets you can leverage
>>>>>>> macrodefs to do this for every target using something like:
>>>>>>>
>>>>>>> <macrodef name="timedtarget">
>>>>>>> <attribute name="name">
>>>>>>> <attribute name="functions"/>
>>>>>>> <sequential>
>>>>>>> <assign var="time_" value="now"/>
>>>>>>> <callinline targets="@{functions}"/> <!--do NOT switch
>>>>>>> projects-->
>>>>>>> <assign var="time_" value="-now" transform="duration"
>>>>>>> copyproperty="@{name}.duration"/>
>>>>>>> <echo level="info" message="@{name} took ${@{name}.duration}"/>
>>>>>>> </sequential>
>>>>>>> </macrodef>
>>>>>>>
>>>>>>> Then use it like so:
>>>>>>>
>>>>>>> <target name="-compile">
>>>>>>> ...[all your compiling work here in private target]
>>>>>>> </target>
>>>>>>>
>>>>>>> <target name="compile" depends="-init" description="Compile stuff">
>>>>>>> <timetarget name="compile" functions="-compile"/>
>>>>>>> </target>
>>>>>>>
>>>>>>> AntXtras is at: http://antxtras.sf.net/
>>>>>>>
>>>>>>> Hope that helps.
>>>>>>>
>>>>>>> -The Wabbit
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org