private static StatsCollection TimeIt(int sampleCount, int iterationCount, IEnumerable <NamedAction> namedActions)
        {
            var collector = new StatsCollection();
            var logger    = new StatsLogger(collector);
            var timer     = new MultiSampleCodeTimer(sampleCount, iterationCount);

            timer.OnMeasure +=
                (name, iterations, scale, samples) => { logger.AddWithCount(name, iterations, scale, samples); };
            namedActions.ToList().ForEach(namedAction => timer.Measure(namedAction.Name, namedAction.TheAction));
            return(collector);
        }
Exemple #2
0
 public MultiSampleCodeTimer(MultiSampleCodeTimer template)
     : this(template.SampleCount, template.IterationCount)
 {
     OnMeasure = template.OnMeasure;
 }