private BenchmarkRunList Run(Action action, int iterationCount, Predicate <BenchmarkRunList> stopPredicate = null) { var runList = new BenchmarkRunList(); var stopwatch = new Stopwatch(); for (int i = 0; i < iterationCount; i++) { stopwatch.Reset(); stopwatch.Start(); action(); stopwatch.Stop(); var run = new BenchmarkRun(stopwatch); runList.Add(run); if (PrintToConsole) { run.Print(); } if (stopPredicate != null && stopPredicate(runList)) { break; } } if (PrintToConsole) { runList.PrintStatistic(); } return(runList); }