Last active
March 9, 2018 14:08
-
-
Save 0xorial/4f8054b2d41960a506e8d10643da0c39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class S : IDisposable | |
{ | |
private static void Log(string s) | |
{ | |
Console.WriteLine(DateTime.Now + ": " + s); | |
} | |
private readonly string _caller; | |
private readonly System.Diagnostics.Stopwatch _s; | |
public S(string caller) | |
{ | |
_s = System.Diagnostics.Stopwatch.StartNew(); | |
_caller = caller; | |
Log("starting " + caller); | |
} | |
public void Dispose() | |
{ | |
_s.Stop(); | |
Log($"finished {_caller} in {_s.ElapsedMilliseconds} ms"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment