UtilProfillingTestExecutionTime Method
Tests the execution of a Action and measures the elapsed time.
This is a code example.
No code example is currently available or this language may not be supported.
Sub Test()
Dim successful As Boolean =
TestSuccess(Sub() Convert.ToInt32("Hello World!"))
Dim teInfo As TestExecutionInfo =
TestTime(Sub()
For x As Integer = 0 To 2500
Console.WriteLine(x)
Next x
End Sub)
Dim sb As New Global.System.Text.StringBuilder
Select Case teInfo.Success
Case True
With sb ' Set an information message.
.AppendLine(String.Format("Method Name: {0}", teInfo.Method.Name))
.AppendLine()
.AppendLine(String.Format("Elapsed Time: {0}", teInfo.Elapsed.ToString("hh\:mm\:ss\:fff")))
End With
MessageBox.Show(sb.ToString(), "Code Execution Measurer", MessageBoxButtons.OK, MessageBoxIcon.Information)
Case Else
With sb ' Set an error message.
.AppendLine("Exception occurred during code execution measuring.")
.AppendLine()
.AppendLine(String.Format("Method Name: {0}", teInfo.Method.Name))
.AppendLine()
.AppendLine(String.Format("Exception Type: {0}", teInfo.Exception.GetType().Name))
.AppendLine()
.AppendLine("Exception Message:")
.AppendLine(teInfo.Exception.Message)
.AppendLine()
.AppendLine("Exception Stack Trace:")
.AppendLine(teInfo.Exception.StackTrace)
End With
MessageBox.Show(sb.ToString(), "Code Execution Measurer", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Select
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.