PowerToys/Wox.Infrastructure/Timeit.cs

24 lines
495 B
C#
Raw Normal View History

using System;
using System.Diagnostics;
namespace Wox.Infrastructure
{
public class Timeit : IDisposable
{
private Stopwatch stopwatch = new Stopwatch();
private string name;
public Timeit(string name)
{
this.name = name;
stopwatch.Start();
}
public void Dispose()
{
stopwatch.Stop();
2015-02-04 23:16:41 +08:00
DebugHelper.WriteLine(name + ":" + stopwatch.ElapsedMilliseconds + "ms");
}
}
}