added perf tests using test driver (#136)

* added perf tests using test driver
This commit is contained in:
Leila Lali
2016-11-08 14:37:43 -08:00
committed by GitHub
parent 3808dcdafd
commit 95a9c86dd3
10 changed files with 1538 additions and 24 deletions

View File

@@ -0,0 +1,59 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Globalization;
namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Utility
{
/// <summary>
/// Timer to calculate the test run time
/// </summary>
public class TestTimer
{
public TestTimer()
{
Start();
}
public void Start()
{
StartDateTime = DateTime.UtcNow;
}
public void End()
{
EndDateTime = DateTime.UtcNow;
}
public void EndAndPrint(string testName)
{
End();
var currentColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Test Name: {0} Run time in milliSeconds: {1}", testName, TotalMilliSeconds));
Console.ForegroundColor = currentColor;
}
public double TotalMilliSeconds
{
get
{
return (EndDateTime - StartDateTime).TotalMilliseconds;
}
}
public double TotalMilliSecondsUntilNow
{
get
{
return (DateTime.UtcNow - StartDateTime).TotalMilliseconds;
}
}
public DateTime StartDateTime { get; private set; }
public DateTime EndDateTime { get; private set; }
}
}