Esempio n. 1
0
        private Stopwatch ExecuteTest <T>(IBenchmark benchmark, IScenarioStrategy strategy, ref List <long> delays) where T : BaseModel
        {
            var stopwatch = new Stopwatch();

            if (strategy is JustReadsStrategy)
            {
                //populateDB
                benchmark.Test <T>(new JustInsertsStrategy {
                    CountOfOperations = strategy.CountOfOperations
                });
                ModelFactory._iterator = ModelFactory.Max;
            }
            if (strategy is ReadsToWritesWithRatioStrategy)
            {
                benchmark.Test <T>(new JustInsertsStrategy {
                    CountOfOperations = (int)(strategy.CountOfOperations * 0.9)
                });
            }

            stopwatch.Start();
            benchmark.Test <T>(strategy);
            stopwatch.Stop();
            benchmark.Dispose();
            delays = benchmark.Delays;
            return(stopwatch);
        }