Spaces:
Runtime error
Runtime error
File size: 442 Bytes
ac55997 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
using System;
using System.Diagnostics;
namespace Quantum
{
public class StopwatchBlock : IDisposable
{
private Stopwatch _stopwatch;
private string _blockName;
public StopwatchBlock(string blockName)
{
_blockName = blockName;
_stopwatch = new Stopwatch();
_stopwatch.Start();
}
void IDisposable.Dispose()
{
_stopwatch.Stop();
Log.Info($"{_blockName}: {_stopwatch.Elapsed.TotalMilliseconds} ms");
}
}
} |