public static void LogIncrementalAnalyzerProcessorStatistics(int correlationId, Solution solution, CountLogAggregator <object> logAggregator, ImmutableArray <IIncrementalAnalyzer> analyzers) { Logger.Log(FunctionId.IncrementalAnalyzerProcessor_Shutdown, KeyValueLogMessage.Create(m => { var solutionHash = GetSolutionHash(solution); m[Id] = correlationId; m[SolutionHash] = solutionHash.ToString(); var statMap = new Dictionary <string, List <int> >(); foreach (var(key, counter) in logAggregator) { if (key is string stringKey) { m[stringKey] = counter.GetCount(); } else if (key is ValueTuple <string, Guid> propertyNameAndId) { var list = statMap.GetOrAdd(propertyNameAndId.Item1, _ => new List <int>()); list.Add(counter.GetCount()); } else { throw ExceptionUtilities.Unreachable; } } foreach (var(propertyName, propertyValues) in statMap) { var result = StatisticResult.FromList(propertyValues); m[CreateProperty(propertyName, Max)] = result.Maximum; m[CreateProperty(propertyName, Min)] = result.Minimum; m[CreateProperty(propertyName, Median)] = result.Median !.Value; m[CreateProperty(propertyName, Mean)] = result.Mean; m[CreateProperty(propertyName, Mode)] = result.Mode !.Value; m[CreateProperty(propertyName, Range)] = result.Range; m[CreateProperty(propertyName, Count)] = result.Count; } })); foreach (var analyzer in analyzers) { analyzer.LogAnalyzerCountSummary(); } }