#1
|
|||
|
|||
Calculate duration based on %DATETIME%
I want to benchmark the performance of an application. What would be the best way to calculate a duration based on %DATETIME% at the beginning and ending. Can it be done without VS or J scripting?
Thanks. |
#2
|
|||
|
|||
Am not sure if this is the best way, but :
1. Insert a "Set Macro" action as the first step and set the value of the macro value as %DATETIME% 2. Insert a "Run Script" action as the last step. Here you can use the marco of the first step and the %DATETIME% to compare the time difference. Hope that helps. Cheers! Rajiv. R Rajspace.Org |
#3
|
|||
|
|||
Scripting would be necessary. The following in a Log Message step at the end of the build would give the build time in seconds (VBScript must be the default script language in Tools | Application Options | General):
Build elapsed time = [DateDiff("s", Builder.StartTime, Now)] seconds Or in a Run Script step (if VBScript is not the default language): Builder.LogMessage "Build elapsed time = " & DateDiff("s", Builder.StartTime, Now) & " seconds" Or to get a different time interval, get the start time as mentioned in the previous post and replace Builder.StartTime with CDate("%START_TIME%") replacing START_TIME with whatever macro name you used. |
#4
|
|||
|
|||
Since I love JScript (and hate VBScript), doing an elapsed time calculation in JScript is...
Code:
var seconds = Math.floor((new Date() - new Date(Builder.StartTime)) / 1000); |
#5
|
|||
|
|||
I was also looking for the elapsed time. I see how to do it from the post. As this post was a few years ago, is that still the best way to get the elapsed time, or are there any built-in macros or functions that return it?
It's no big deal if this is still the best way to do it; I'm just checking as Visual Build has had enhancements since this information. |
#6
|
|||
|
|||
That's still the best way.
|
|
|