Printing Ant target execution time

后端 未结 4 461
广开言路
广开言路 2020-12-14 08:13

I want to print the execution time taken for each individual Ant target and its dependent targets.



        
相关标签:
4条回答
  • 2020-12-14 08:24

    There is the TStamp task that you can use to demark your other tasks.

    See here: http://ant.apache.org/manual/Tasks/tstamp.html

    There is some extension/addon that will do it all for you without having to do this. Will scrabble around for it if no-one comes up with it first.

    0 讨论(0)
  • 2020-12-14 08:40

    Use one of the listeners from Ant add-on task collections:

    • antutility
    • antelope
    • antcontrib With -listener net.sf.antcontrib.perf.AntPerformanceListener

    Or check their sources, and roll your own listener.

    0 讨论(0)
  • 2020-12-14 08:41

    If you're using ant-contrib, then there is a stopwatch task. Put it at the top and bottom of each target and it will report the elapsed and total times.

    http://ant-contrib.sourceforge.net/tasks/tasks/index.html

    0 讨论(0)
  • 2020-12-14 08:44

    Since Ant 1.8.0 you can use a profilelogger to do this.

    ant -logger org.apache.tools.ant.listener.ProfileLogger target
    

    Produces output like

    Target aTarget: started Thu Jan 22 09:01:00 CET 2009

    echo: started Thu Jan 22 09:01:00 CET 2009 [echo] echo-task

    echo: finishedThu Jan 22 09:01:00 CET 2009 (250ms)

    zip: started Thu Jan 22 09:01:00 CET 2009 [zip] Building zip: ...\my.zip

    zip: finishedThu Jan 22 09:01:01 CET 2009 (1313ms)

    Target aTarget: finishedThu Jan 22 09:01:01 CET 2009 (1719ms)

    0 讨论(0)
提交回复
热议问题