static CandidateMetrics Create <TContext>(
     IBenchmarkCandidate <TContext> candidate,
     TContext context,
     int numberOfRuns     = 10,
     TimeSpan[] durations = null)
     where TContext : class, IBenchmarkContext
 {
     return(CandidateMetrics.Create <TContext>(
                candidate,
                context,
                numberOfRuns,
                durations));
 }
Example #2
0
        public static CandidateMetrics Create <TContext>(
            IBenchmarkCandidate <TContext> candidate,
            TContext context,
            int numberOfRuns,
            TimeSpan[] durations)
            where TContext : class, IBenchmarkContext
        {
            var elapsedTicks = durations.Sum(x => x.Ticks);

            var benchmarkComment = candidate as IBenchmarkComment;

            return(new CandidateMetrics(
                       candidate.Name,
                       TimeSpan.FromTicks(elapsedTicks),
                       TimeSpan.FromTicks((long)Math.Round((decimal)elapsedTicks / numberOfRuns)),
                       durations.OrderBy(x => x.Ticks).ElementAt(durations.Count() / 2),
                       benchmarkComment?.GetComment(context),
                       numberOfRuns));
        }
Example #3
0
 public BenchmarkExecutorLargeDataSet()
 {
     newtonSoftLargeDataSet = new NetJson <SFCityLots>(sourceFilePath);
     netJsonLargeDataSet    = new NetJson <SFCityLots>(sourceFilePath);
 }
 public BenchmarkCandidateNullContextWrapper(IBenchmarkCandidate candidate)
 {
     this.candidate = candidate;
 }