LogicalOperation.cs
26 lines
| 647 B
| text/x-csharp
|
CSharpLexer
cin
|
r253 | using System; | |
cin
|
r286 | using Stopwatch = System.Diagnostics.Stopwatch; | |
cin
|
r253 | ||
namespace Implab.Diagnostics { | |||
public class LogicalOperation { | |||
cin
|
r286 | readonly Stopwatch m_stopwatch; | |
cin
|
r253 | ||
public string Name { get; private set; } | |||
internal LogicalOperation(string name) { | |||
Name = string.IsNullOrEmpty(name) ? "<unnamed>" : name; | |||
cin
|
r286 | m_stopwatch = Stopwatch.StartNew(); | |
} | |||
public TimeSpan Elapsed { | |||
get { | |||
return m_stopwatch.Elapsed; | |||
} | |||
} | |||
public void End() { | |||
m_stopwatch.Stop(); | |||
cin
|
r253 | } | |
public override string ToString() => Name; | |||
} | |||
} |