/// <summary>Check competition target limits.</summary> /// <param name="competitionTarget">The competition target.</param> /// <param name="benchmarksForTarget">Benchmarks for the target.</param> /// <param name="summary">Summary for the run.</param> /// <param name="competitionState">State of the run.</param> /// <param name="warnings">The warnings.</param> /// <returns><c>true</c> if competition limits are ok.</returns> protected virtual bool CheckCompetitionTargetLimits( CompetitionTarget competitionTarget, Benchmark[] benchmarksForTarget, Summary summary, CompetitionState competitionState, List <IWarning> warnings) { if (competitionTarget.Target.Baseline || competitionTarget.DoesNotCompete) { return(true); } var result = true; foreach (var benchmark in benchmarksForTarget) { result &= CheckCompetitionLimitsCore( benchmark, summary, competitionTarget, competitionState, warnings); } return(result); }
private CompetitionTarget TryParseCompetitionTarget( Target target, CompetitionMetadata competitionMetadata, CompetitionState competitionState) { var competitionAttribute = target.Method.GetCustomAttribute <CompetitionBenchmarkAttribute>(); if (competitionAttribute == null) { return(null); } var fallbackLimit = CompetitionLimit.Empty; CompetitionTarget result; if (competitionMetadata == null) { var limit = TryParseCompetitionLimit(competitionAttribute) ?? fallbackLimit; result = new CompetitionTarget(target, limit, competitionAttribute.DoesNotCompete); } else { var limit = TryParseCompetitionLimit(target, competitionMetadata, competitionState) ?? fallbackLimit; result = new CompetitionTarget(target, limit, competitionAttribute.DoesNotCompete, competitionMetadata); } return(result); }
private static bool OnCheckTarget( [NotNull] CompetitionTarget competitionTarget, [NotNull] Benchmark[] benchmarksForTarget, [NotNull] SummaryAnalysis analysis) { var result = true; foreach (var metricValue in competitionTarget.MetricValues) { foreach (var benchmark in benchmarksForTarget) { result &= CheckBenchmark(benchmark, metricValue, analysis); } } return(result); }
/// <summary>Check competition target limits.</summary> /// <param name="competitionTarget">The competition target.</param> /// <param name="benchmarksForTarget">Benchmarks for the target.</param> /// <param name="summary">Summary for the run.</param> /// <param name="competitionState">State of the run.</param> /// <param name="warnings">The warnings.</param> /// <returns><c>true</c> if competition limits are ok.</returns> protected override bool CheckCompetitionTargetLimits( CompetitionTarget competitionTarget, Benchmark[] benchmarksForTarget, Summary summary, CompetitionState competitionState, List <IWarning> warnings) { var checkPassed = base.CheckCompetitionTargetLimits( competitionTarget, benchmarksForTarget, summary, competitionState, warnings); if (checkPassed || competitionState.RunNumber <= SkipRunsBeforeApplyingAnnotations) { return(checkPassed); } foreach (var benchmark in benchmarksForTarget) { if (benchmark.Target.Baseline) { continue; } var limit = CompetitionLimitProvider.TryGetCompetitionLimit(benchmark, summary); if (limit == null) { // No warnings required. Missing values should be checked by base CheckCompetitionTargetLimits() method. continue; } competitionTarget.UnionWith(limit); } return(false); }