narsil/Tanshu.Accounts.PointOfSale/Profiling/BlockTimer.cs
Tanshu a984b1f527 Switched to management branch to develop management module.
Initial commit dunno what has changed.
2012-12-01 15:18:02 +05:30

26 lines
675 B
C#

using System;
namespace Tanshu.Accounts.PointOfSale
{
public class BlockTimer : IDisposable
{
private readonly string _description;
private readonly long _start;
public BlockTimer(string description)
{
_description = description;
_start = DateTime.Now.Ticks;
}
public void Dispose()
{
var totalTime = DateTime.Now.Ticks - _start;
Console.WriteLine(_description);
Console.Write(" - Total Execution Time: ");
Console.Write(new TimeSpan(totalTime).TotalMilliseconds.ToString());
Console.WriteLine(" ms.");
}
}
}