Created
July 31, 2014 07:56
-
-
Save yemrekeskin/9b44914d9add6e14189a to your computer and use it in GitHub Desktop.
Benchmark Entity Modelling
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 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