/// <summary>Refills the competition targets collection.</summary> /// <param name="competitionTargets">The collection to be filled with competition targets.</param> /// <param name="summary">Summary for the run.</param> /// <param name="competitionState">State of the run.</param> protected virtual void FillCompetitionTargets( CompetitionTargets competitionTargets, Summary summary, CompetitionState competitionState) { // DONTTOUCH: DO NOT add return into the if clause. // The competitionTargets should be filled with empty limits if IgnoreExistingAnnotations set to false if (IgnoreExistingAnnotations) { competitionState.WriteMessage( MessageSource.Analyser, MessageSeverity.Informational, $"Existing benchmark limits are ignored due to {nameof(IgnoreExistingAnnotations)} setting."); } bool hasBaseline = false; competitionTargets.Clear(); var targets = summary.GetExecutionOrderBenchmarks() .Select(b => b.Target) .ToHashSet(); if (targets.Count == 0) { return; } var targetType = targets.First().Type; var competitionMetadata = AttributeAnnotations.TryGetCompetitionMetadata(targetType); foreach (var target in targets) { hasBaseline |= target.Baseline; var competitionTarget = TryParseCompetitionTarget(target, competitionMetadata, competitionState); if (competitionTarget != null) { competitionTargets.Add(target.Method, competitionTarget); } } if (!hasBaseline && competitionTargets.Any()) { competitionState.WriteMessage( MessageSource.Analyser, MessageSeverity.SetupError, $"The benchmark {targetType.Name} has no baseline."); } }
private void AnalyseCore( Summary summary, CompetitionTargets competitionTargets, CompetitionState competitionState, List <IWarning> warnings) { if (competitionState.HasCriticalErrorsInRun) { return; } if (!TryInitialize(summary, competitionTargets, competitionState)) { return; } if (competitionTargets.Any()) { CheckCompetitionLimitsCore(summary, competitionState, warnings); } else { CheckPostconditions(summary, competitionState, warnings); } }