public GrowingInputExperimentResult Run <T>(IGrowingInputExperiment <T> growingInputExperiment)
        {
            DebugerNotAttached.Check();

            var probeResults = new List <GrowingInputProbeResult>();
            var sizeSettings = growingInputExperiment.InputSettings;

            foreach (var probe in growingInputExperiment.GetProbes())
            {
                //heatup
                probe(growingInputExperiment.Generate(sizeSettings.From));

                var measurements = new List <Measurement>();
                var size         = sizeSettings.From;
                while (size <= sizeSettings.To)
                {
                    var input = growingInputExperiment.Generate(size);

                    GC.Collect();
                    var sw = Stopwatch.StartNew();
                    probe(input);
                    sw.Stop();

                    measurements.Add(new Measurement(size, sw.Elapsed));

                    size = sizeSettings.NextSize(size);
                }

                probeResults.Add(new GrowingInputProbeResult(probe.Method.Name, measurements));
            }

            return(new GrowingInputExperimentResult(growingInputExperiment.GetType().Name, probeResults));
        }
        public RepeatExperimentResult Run(IRepeatExperiment repeatExperiment)
        {
            DebugerNotAttached.Check();

            var probeResults   = new List <RepeatProbeResult>();
            var repeatSettings = repeatExperiment.RepeatSettings;

            foreach (var probe in repeatExperiment.GetProbes())
            {
                //heatup
                repeatExperiment.BeforeProbeRun();
                probe();

                var durations = new List <TimeSpan>();
                for (var i = 0; i < repeatSettings.RepeatTimes; i++)
                {
                    repeatExperiment.BeforeProbeRun();

                    GC.Collect();
                    var sw = Stopwatch.StartNew();
                    probe();
                    sw.Stop();
                    durations.Add(sw.Elapsed);
                }

                probeResults.Add(new RepeatProbeResult(probe.Method.Name, durations));
            }

            return(new RepeatExperimentResult(repeatExperiment.GetType().Name, probeResults));
        }