Question:
I am having build script in msbuild which will be invoked by powershell.
Build log file would look like this.
Build started 12/19/2011 2:01:54 PM.
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.28
At starting point it will specify the build execution initiated time and the end it will say Time elapsed.
I would like to find the execution time using powershell or msbuild. How can i add all the time elapsed value or find the difference between last build started occurrence with first build occurrence?
As it is in log file , i don’t know how to retrieve this and measure.
Answer:
Use Measure-Commmand
to see how long is your build process. Here’s an example:
1 2 |
Measure-Command { ./build.ps1 } |
The output on my machine was:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
PS D:\> Measure-Command { ./build.ps1 } Days : 0 Hours : 0 Minutes : 0 Seconds : 6 Milliseconds : 443 Ticks : 64439301 TotalDays : 7.45825243055556E-05 TotalHours : 0.00178998058333333 TotalMinutes : 0.107398835 TotalSeconds : 6.4439301 TotalMilliseconds : 6443.9301 |