Last active
December 28, 2015 16:56
-
-
Save georgebearden/9e824dbafb39a2297f8f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 static class MethodTimeLogger | |
| { | |
| public static void Log(MethodBase methodBase, long milliseconds) | |
| { | |
| } | |
| } | |
| class Program | |
| { | |
| [Time] | |
| static void TestMethod() | |
| { | |
| } | |
| static void Main(string[] args) | |
| { | |
| int numIterations = 100; | |
| long totalMillis = 0; | |
| for (int i = 0; i < numIterations; i++) | |
| { | |
| var stopwatch = Stopwatch.StartNew(); | |
| for (int j = 0; j < 1000000; j++) | |
| TestMethod(); | |
| stopwatch.Stop(); | |
| totalMillis += stopwatch.ElapsedMilliseconds; | |
| } | |
| Debug.WriteLine(totalMillis / numIterations); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment