Skip to content

Instantly share code, notes, and snippets.

@georgebearden
Last active December 28, 2015 16:56
Show Gist options
  • Select an option

  • Save georgebearden/9e824dbafb39a2297f8f to your computer and use it in GitHub Desktop.

Select an option

Save georgebearden/9e824dbafb39a2297f8f to your computer and use it in GitHub Desktop.
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