Skip to content

Instantly share code, notes, and snippets.

@yemrekeskin
Created July 31, 2014 07:56
Show Gist options
  • Save yemrekeskin/9b44914d9add6e14189a to your computer and use it in GitHub Desktop.
Save yemrekeskin/9b44914d9add6e14189a to your computer and use it in GitHub Desktop.
Benchmark Entity Modelling
public class Benchmark
{
public static BenchmarkResult Run(Action action)
{
return Run(action, null, null);
}
public static BenchmarkResult Run(Action action, string name, string message)
{
var dateStarted = DateTime.Now;
action();
var br = new BenchmarkResult();
br.DateStarted = dateStarted;
br.Name = name;
br.Message = message;
br.DateEnded = DateTime.Now;
br.Elapsed = br.DateStarted - br.DateEnded;
return br;
}
}
public class BenchmarkResult
{
public string Name { get; set; }
public string Message { get; set; }
public DateTime DateStarted { get; set; }
public DateTime DateEnded { get; set; }
public TimeSpan Elapsed { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment