Build Duration Macro





5.00/5 (2 votes)
Oct 2, 2001

56463
A DevStudio macro that displays the project's build duration
Introduction
This macro adds a missing feature to DevStudio6. It displays project build duration. You'll see a new tab named Macro in the output window (next to the standard tabs: Build, Debug, Find in files...)
Open your macro file and insert the following line before any other functions or subroutines.
Public dBuildStartTime
Next, place the code below somewhere in your macro file. These events (Application_BeforeBuildStart
and
Application_BuildFinish
) will be automatically triggered by DevStudio when you build your projects.
Sub Application_BeforeBuildStart() ' keep the build-starting time dBuildStartTime = Now Application.PrintToOutputWindow " " Application.PrintToOutputWindow "--------------------------------" Application.PrintToOutputWindow "Build start: " & dBuildStartTime End Sub Sub Application_BuildFinish(nNumErrors, nNumWarnings) ' get build time dNow = Now sec = DateDiff("s", dBuildStartTime, dNow) hours = sec \ 3600 sec = sec - hours * 3600 min = sec \ 60 sec = sec - min * 60 ' format Dim strH, strM, strS If hours > 10 Then strH = hours Else strH = "0" & hours End If If min > 10 Then strM = min Else strM = "0" & min End If If sec > 10 Then strS = sec Else strS = "0" & sec End If ' display Application.PrintToOutputWindow "Build end: " & dNow Application.PrintToOutputWindow "Build time: " & strH & ":" & strM & ":" & strS Application.PrintToOutputWindow nNumWarnings & " warning(s), " & nNumErrors & " error(s)." End Sub