Created
July 31, 2017 00:40
-
-
Save brendanmckenzie/48da2d830c55778f9d2623d7c1c3e52a 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
internal sealed class BasicProfiler : IDisposable | |
{ | |
readonly string _key; | |
readonly System.Diagnostics.Stopwatch _stopwatch; | |
public BasicProfiler(string key) | |
{ | |
_key = key; | |
_stopwatch = new System.Diagnostics.Stopwatch(); | |
_stopwatch.Start(); | |
System.Diagnostics.Debug.WriteLine($"Started profiling: {key}"); | |
} | |
public void Dispose() | |
{ | |
_stopwatch.Stop(); | |
System.Diagnostics.Debug.WriteLine($"Stopped profiling: {_key} -- {_stopwatch.ElapsedMilliseconds:N0}ms"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment