async Task RunForChromeDebug(LogSourcePostprocessorInput input) { var reader = new CDL.Reader(postprocessing.TextLogParser, input.CancellationToken).Read(input.OpenLogFile, s => s.Dispose(), input.ProgressHandler); var multiplexedInput = reader.Multiplex(); IPrefixMatcher prefixMatcher = postprocessing.CreatePrefixMatcher(); var matchedMessages = multiplexedInput.MatchTextPrefixes(prefixMatcher).Multiplex(); var webRtcStateInspector = new CDL.WebRtcStateInspector(prefixMatcher); var processIdDetector = new CDL.ProcessIdDetector(); var nodeDetectionTokenTask = (new CDL.NodeDetectionTokenSource(processIdDetector, webRtcStateInspector)).GetToken(matchedMessages); var matcher = postprocessing.CreatePrefixMatcher(); var extensionSources = pluginModel.ChromeDebugLogMessagingEventSources.Select(src => src( matcher, multiplexedInput, input.TemplatesTracker)).ToArray(); var events = EnumerableAsync.Merge(extensionSources.Select(s => s.Events).ToArray()); var serialize = postprocessing.Correlation.CreatePostprocessorOutputBuilder() .SetSameNodeDetectionToken(nodeDetectionTokenTask) .SetMessagingEvents(events) .SetTriggersConverter(evtTrigger => TextLogEventTrigger.FromUnknownTrigger(evtTrigger)) .Build(input); var tasks = new List <Task>(); tasks.Add(serialize); tasks.AddRange(extensionSources.SelectMany(s => s.MultiplexingEnumerables.Select(e => e.Open()))); tasks.Add(matchedMessages.Open()); tasks.Add(multiplexedInput.Open()); await Task.WhenAll(tasks); }
async Task RunForSymRTC( IEnumerableAsync <Sym.Message[]> messages, LogSourcePostprocessorInput postprocessorInput ) { IPrefixMatcher matcher = postprocessing.CreatePrefixMatcher(); var logMessages = messages.MatchTextPrefixes(matcher).Multiplex(); Sym.IMeetingsStateInspector symMeetingsStateInspector = new Sym.MeetingsStateInspector(matcher); Sym.IMediaStateInspector symMediaStateInspector = new Sym.MediaStateInspector(matcher, symMeetingsStateInspector); var symMeetingEvents = symMeetingsStateInspector.GetEvents(logMessages); var symMediagEvents = symMediaStateInspector.GetEvents(logMessages); matcher.Freeze(); var events = postprocessorInput.TemplatesTracker.TrackTemplates(EnumerableAsync.Merge( symMeetingEvents, symMediagEvents )); var serialize = postprocessing.StateInspector.SavePostprocessorOutput( events, null, evtTrigger => TextLogEventTrigger.Make((Sym.Message)evtTrigger), postprocessorInput ); await Task.WhenAll(serialize, logMessages.Open()); }
async Task RunForChromeDebug( IEnumerableAsync <CDL.Message[]> input, LogSourcePostprocessorInput postprocessorInput ) { var multiplexedInput = input.Multiplex(); IPrefixMatcher matcher = postprocessing.CreatePrefixMatcher(); var extensionSources = pluginModel.ChromeDebugLogTimeLineEventSources.Select(src => src( matcher, multiplexedInput, postprocessorInput.TemplatesTracker)).ToArray(); var events = postprocessorInput.TemplatesTracker.TrackTemplates(EnumerableAsync.Merge(extensionSources.Select(s => s.Events).ToArray())); matcher.Freeze(); var serialize = postprocessing.Timeline.CreatePostprocessorOutputBuilder() .SetEvents(events) .SetTriggersConverter(evtTrigger => TextLogEventTrigger.FromUnknownTrigger(evtTrigger)) .Build(postprocessorInput); var tasks = new List <Task>(); tasks.Add(serialize); tasks.AddRange(extensionSources.SelectMany(s => s.MultiplexingEnumerables.Select(e => e.Open()))); tasks.Add(multiplexedInput.Open()); await Task.WhenAll(tasks); }
public TimelineEvents( IPrefixMatcher matcher ) { devToolsNetworkEventPrefix1 = matcher.RegisterPrefix(DevTools.Events.Network.Base.Prefix1); devToolsNetworkEventPrefix2 = matcher.RegisterPrefix(DevTools.Events.Network.Base.Prefix2); }
public MediaStateInspector( IPrefixMatcher matcher, IMeetingsStateInspector meetingsStateInspector ) { this.meetingsStateInspector = meetingsStateInspector; }
async Task RunForSymLog( IEnumerableAsync <Sym.Message[]> input, LogSourcePostprocessorInput postprocessorInput ) { IPrefixMatcher matcher = postprocessing.CreatePrefixMatcher(); var inputMultiplexed = input.Multiplex(); var symEvents = RunForSymMessages(matcher, inputMultiplexed, postprocessorInput.TemplatesTracker, out var symLog); var endOfTimelineEventSource = postprocessing.Timeline.CreateEndOfTimelineEventSource <Sym.Message>(); var messagingEventsSource = postprocessing.Timeline.CreateMessagingEventsSource(); var messagingEvents = messagingEventsSource.GetEvents( ((Sym.IMessagingEvents) new Sym.MessagingEvents()).GetEvents(inputMultiplexed)); var eofEvts = endOfTimelineEventSource.GetEvents(inputMultiplexed); matcher.Freeze(); var events = EnumerableAsync.Merge( symEvents, messagingEvents, eofEvts ); var serialize = postprocessing.Timeline.CreatePostprocessorOutputBuilder() .SetEvents(events) .SetTriggersConverter(evtTrigger => TextLogEventTrigger.Make((Sym.Message)evtTrigger)) .Build(postprocessorInput); await Task.WhenAll(serialize, symLog.Open(), inputMultiplexed.Open()); }
private void TestPrefixExistence(IPrefixMatcher sut, IList <string> testData) { for (int i = 0; i < testData.Count; i++) { sut.HasPrefix(testData[i]); } }
private static async Task <List <Event> > RunForSymMessages( IPrefixMatcher matcher, IEnumerableAsync <Sym.Message[]> messages ) { Sym.IMeetingsStateInspector symMeetingsStateInsector = new Sym.MeetingsStateInspector(matcher); Sym.IMediaStateInspector symMediaStateInsector = new Sym.MediaStateInspector(matcher); Sym.ITimelineEvents symTimelineEvents = new Sym.TimelineEvents(matcher); var symLog = Sym.Helpers.MatchPrefixes(messages, matcher).Multiplex(); var symMeetingStateEvents = symMeetingsStateInsector.GetEvents(symLog); var symMediaStateEvents = symMediaStateInsector.GetEvents(symLog); var symMeetingEvents = (new InspectedObjectsLifetimeEventsSource(e => e.ObjectType == Sym.MeetingsStateInspector.MeetingTypeInfo || e.ObjectType == Sym.MeetingsStateInspector.MeetingSessionTypeInfo || e.ObjectType == Sym.MeetingsStateInspector.MeetingRemoteParticipantTypeInfo )).GetEvents(symMeetingStateEvents); var symMediaEvents = (new InspectedObjectsLifetimeEventsSource(e => e.ObjectType == Sym.MediaStateInspector.LocalScreenTypeInfo || e.ObjectType == Sym.MediaStateInspector.LocalAudioTypeInfo || e.ObjectType == Sym.MediaStateInspector.LocalVideoTypeInfo )).GetEvents(symMediaStateEvents); var events = EnumerableAsync.Merge( symMeetingEvents, symMediaEvents, symTimelineEvents.GetEvents(symLog) ).ToFlatList(); await Task.WhenAll(events, symLog.Open()); return(events.Result); }
async Task RunForWebRTCDump( IEnumerableAsync <WRD.Message[]> inputMessages, LogSourcePostprocessorInput postprocessorInput ) { IPrefixMatcher matcher = postprocessing.CreatePrefixMatcher(); var logMessages = WRD.Helpers.MatchPrefixes(inputMessages, matcher).Multiplex(); WRD.IWebRtcStateInspector webRtcStateInspector = new WRD.WebRtcStateInspector(matcher); var webRtcEvts = webRtcStateInspector.GetEvents(logMessages); matcher.Freeze(); var events = postprocessorInput.TemplatesTracker.TrackTemplates(EnumerableAsync.Merge( webRtcEvts )); var serialize = postprocessing.StateInspector.SavePostprocessorOutput( events, null, evtTrigger => TextLogEventTrigger.Make((WRD.Message)evtTrigger), postprocessorInput ); await Task.WhenAll(serialize, logMessages.Open()); }
private void TestPrefixCompletionSuggestions(IPrefixMatcher sut, IList <string> testData) { for (int i = 0; i < testData.Count; i++) { IList <string> prefixes = sut.GetWordsByPrefix(testData[i]).Take(10).ToList(); //to list ensures we actually use the generator if there is a generator implementation underneath //take limits number of responses like somebody would do on a drop down list } }
async Task RunForChromeDriver(LogSourcePostprocessorInput input) { var reader = (new CD.Reader(postprocessing.TextLogParser, input.CancellationToken)).Read(input.LogFileName, input.ProgressHandler); IPrefixMatcher prefixMatcher = postprocessing.CreatePrefixMatcher(); var matchedMessages = reader.MatchTextPrefixes(prefixMatcher).Multiplex(); var nodeDetectionTokenTask = (new CD.NodeDetectionTokenSource(new CD.ProcessIdDetector(prefixMatcher), prefixMatcher)).GetToken(matchedMessages); var noMessagingEvents = EnumerableAsync.Empty <M.Event[]>(); var serialize = postprocessing.Correlation.CreatePostprocessorOutputBuilder() .SetSameNodeDetectionToken(nodeDetectionTokenTask) .SetTriggersConverter(evtTrigger => TextLogEventTrigger.Make((CD.Message)evtTrigger)) .Build(input); await Task.WhenAll( matchedMessages.Open(), serialize ); }
async Task RunForChromeDebug( IEnumerableAsync <CDL.Message[]> inputMessages, LogSourcePostprocessorInput postprocessorInput ) { var inputMultiplexed = inputMessages.Multiplex(); IPrefixMatcher matcher = postprocessing.CreatePrefixMatcher(); var logMessages = inputMultiplexed.MatchTextPrefixes(matcher).Multiplex(); CDL.IWebRtcStateInspector webRtcStateInspector = new CDL.WebRtcStateInspector(matcher); var webRtcEvts = webRtcStateInspector.GetEvents(logMessages); var extensionSources = pluginModel .ChromeDebugStateEventSources.Select( source => source(matcher, inputMultiplexed, postprocessorInput.TemplatesTracker) ) .ToArray(); var eventSources = new List <IEnumerableAsync <Event[]> > { webRtcEvts }; eventSources.AddRange(extensionSources.Select(s => s.Events)); matcher.Freeze(); var events = postprocessorInput.TemplatesTracker.TrackTemplates(EnumerableAsync.Merge(eventSources.ToArray())); var serialize = postprocessing.StateInspector.SavePostprocessorOutput( events, null, evtTrigger => TextLogEventTrigger.FromUnknownTrigger(evtTrigger), postprocessorInput ); var tasks = new List <Task>(); tasks.Add(serialize); tasks.AddRange(extensionSources.SelectMany(s => s.MultiplexingEnumerables.Select(e => e.Open()))); tasks.Add(logMessages.Open()); tasks.Add(inputMultiplexed.Open()); await Task.WhenAll(tasks); }
private TimeSpan?Test(Stopwatch watch, IPrefixMatcher sut, IList <string> testData, Action <IPrefixMatcher, IList <string> > test) { try { watch = new Stopwatch(); watch.Start(); for (int i = 0; i < TestRuns; i++) { test(sut, testData); } watch.Stop(); return(watch.Elapsed / TestRuns); } catch (NotImplementedException) { return(null); } }
public WebRtcStateInspector( IPrefixMatcher matcher ) { sessionPrefix = matcher.RegisterPrefix("Session:"); connPrefix = matcher.RegisterPrefix("Conn["); portPrefix = matcher.RegisterPrefix("Jingle:Port["); audioRecvStreamCtrPrefix = matcher.RegisterPrefix("AudioReceiveStream: {"); audioRecvStreamDtrPrefix = matcher.RegisterPrefix("~AudioReceiveStream: {"); audioSendStreamCtrPrefix = matcher.RegisterPrefix("AudioSendStream: {"); audioSendStreamDtrPrefix = matcher.RegisterPrefix("~AudioSendStream: {"); videoRecvStreamCtrPrefix = matcher.RegisterPrefix("VideoReceiveStream: {"); videoRecvStreamDtrPrefix = matcher.RegisterPrefix("~VideoReceiveStream: {"); videoSendStreamCtrPrefix = matcher.RegisterPrefix("VideoSendStreamInternal: {"); videoSendStreamDtrPrefix = matcher.RegisterPrefix("~VideoSendStreamInternal: {"); connReGroupNames = GetReGroupNames(connCreatedRe); portReGroupNames = GetReGroupNames(portGeneric); candidateReGroupNames = GetReGroupNames(new Regex(string.Format(candidateRePattern, ""), RegexOptions.ExplicitCapture)); }
private IEnumerableAsync <Event[]> RunForSymMessages( IPrefixMatcher matcher, IEnumerableAsync <Sym.Message[]> messages, ICodepathTracker templatesTracker, out IMultiplexingEnumerable <MessagePrefixesPair <Sym.Message>[]> symLog ) { Sym.IMeetingsStateInspector symMeetingsStateInspector = new Sym.MeetingsStateInspector(matcher); Sym.IMediaStateInspector symMediaStateInsector = new Sym.MediaStateInspector(matcher, symMeetingsStateInspector); Sym.ITimelineEvents symTimelineEvents = new Sym.TimelineEvents(matcher); Sym.Diag.ITimelineEvents diagTimelineEvents = new Sym.Diag.TimelineEvents(matcher); symLog = messages.MatchTextPrefixes(matcher).Multiplex(); var symMeetingStateEvents = symMeetingsStateInspector.GetEvents(symLog); var symMediaStateEvents = symMediaStateInsector.GetEvents(symLog); var symMeetingEvents = postprocessing.Timeline.CreateInspectedObjectsLifetimeEventsSource(e => e.ObjectType == Sym.MeetingsStateInspector.MeetingTypeInfo || e.ObjectType == Sym.MeetingsStateInspector.MeetingSessionTypeInfo || e.ObjectType == Sym.MeetingsStateInspector.MeetingRemoteParticipantTypeInfo || e.ObjectType == Sym.MeetingsStateInspector.ProbeSessionTypeInfo || e.ObjectType == Sym.MeetingsStateInspector.InvitationTypeInfo ).GetEvents(symMeetingStateEvents); var symMediaEvents = postprocessing.Timeline.CreateInspectedObjectsLifetimeEventsSource(e => e.ObjectType == Sym.MediaStateInspector.LocalScreenTypeInfo || e.ObjectType == Sym.MediaStateInspector.LocalAudioTypeInfo || e.ObjectType == Sym.MediaStateInspector.LocalVideoTypeInfo || e.ObjectType == Sym.MediaStateInspector.TestSessionTypeInfo ).GetEvents(symMediaStateEvents); var events = templatesTracker.TrackTemplates(EnumerableAsync.Merge( symMeetingEvents, symMediaEvents, symTimelineEvents.GetEvents(symLog), diagTimelineEvents.GetEvents(symLog) )); return(events); }
async Task RunForChromeDriver( IEnumerableAsync <CD.Message[]> input, LogSourcePostprocessorInput postprocessorInput ) { IPrefixMatcher matcher = postprocessing.CreatePrefixMatcher(); var logMessages = input.MatchTextPrefixes(matcher).Multiplex(); CD.ITimelineEvents networkEvents = new CD.TimelineEvents(matcher); var endOfTimelineEventSource = postprocessing.Timeline.CreateEndOfTimelineEventSource <MessagePrefixesPair <CD.Message> > (m => m.Message); var extensionSources = pluginModel.ChromeDriverTimeLineEventSources.Select(src => src( matcher, logMessages, postprocessorInput.TemplatesTracker)).ToArray(); var networkEvts = networkEvents.GetEvents(logMessages); var eofEvts = endOfTimelineEventSource.GetEvents(logMessages); matcher.Freeze(); var events = extensionSources.Select(s => s.Events).ToList(); events.Add(networkEvts); events.Add(eofEvts); var serialize = postprocessing.Timeline.SavePostprocessorOutput( EnumerableAsync.Merge(events.ToArray()), null, evtTrigger => TextLogEventTrigger.Make((CD.Message)evtTrigger), postprocessorInput ); var tasks = new List <Task>(); tasks.Add(serialize); tasks.AddRange(extensionSources.SelectMany(s => s.MultiplexingEnumerables.Select(e => e.Open()))); tasks.Add(logMessages.Open()); await Task.WhenAll(tasks); }
private void AssertHaveProvidedWords(IPrefixMatcher tester, IEnumerable <string> words) { var orderedWords = words.OrderBy(x => x).ToArray(); var testerWords = tester.GetWordsByPrefix("").OrderBy(x => x).ToArray(); try { Assert.Equal(orderedWords, testerWords); } catch (EqualException) { var onlyInTester = string.Join(", ", testerWords.Except(orderedWords)); var onlyInExpected = string.Join(", ", orderedWords.Except(testerWords)); var duplicates = string.Join(", ", testerWords.GroupBy(x => x).Select(x => new { count = x.Count(), word = x.Key }).Where(x => x.count > 1)); Assert.True(false, $"Collections differ:\nOnly in tester: {onlyInTester}\nOnly in expected: {onlyInExpected}\nDuplicates: {duplicates}"); } foreach (var word in orderedWords) { Assert.True(tester.HasPrefix(word), $"Prefix: {word} should exist in Dawg, but its not"); Assert.True(tester.HasWord(word), $"Word: {word} should exist in Dawg, but its not"); } }
public MeetingsStateInspector( IPrefixMatcher matcher ) { }
/// <summary> /// Create an empty trie with an empty root node. /// </summary> public Trie() { this.root = new TrieNode <V>(null, '\0'); this.Matcher = new PrefixMatcher <V>(this.root); }
public WebRtcStateInspector( IPrefixMatcher matcher ) { }
public MediaStateInspector( IPrefixMatcher matcher ) { }
public static IEnumerableAsync <MessagePrefixesPair <M>[]> MatchTextPrefixes <M>(this IEnumerableAsync <M[]> input, IPrefixMatcher prefixMatcher) where M : ITriggerText { return(input.Select( msgs => msgs.Select( m => new MessagePrefixesPair <M>(m, prefixMatcher.Match(m.Text)) ).ToArray() )); }
public CITimelineEvents(IPrefixMatcher matcher) { devToolsConsoleEventPrefix = matcher.RegisterPrefix(CD.DevTools.Events.Runtime.LogAPICalled.Prefix1); }
public NodeDetectionTokenSource(IProcessIdDetector processIdDetector, IPrefixMatcher prefixMatcher) { this.processIdDetector = processIdDetector; this.consoleApiPrefix = prefixMatcher.RegisterPrefix(DevTools.Events.Runtime.LogAPICalled.Prefix); }
public ProcessIdDetector(IPrefixMatcher prefixMatcher) { dataCollectedPrefix1 = prefixMatcher.RegisterPrefix(DevTools.Events.Tracing.DataCollected.Prefix1); dataCollectedPrefix2 = prefixMatcher.RegisterPrefix(DevTools.Events.Tracing.DataCollected.Prefix2); }
public static IEnumerableAsync <MessagePrefixesPair[]> MatchPrefixes(this IEnumerableAsync <Message[]> input, IPrefixMatcher prefixMatcher) { return(input.Select( msgs => msgs.Select( m => new MessagePrefixesPair(m, prefixMatcher.Match(m.Text)) ).ToArray() )); }
public TimelineEvents( IPrefixMatcher matcher ) { }
async Task <IPostprocessorRunSummary> Run(LogSourcePostprocessorInput[] inputFiles, IPostprocessorsRegistry postprocessorsRegistry) { var usedRoleInstanceNames = new HashSet <string>(); Func <LogSourcePostprocessorInput, string> getUniqueRoleInstanceName = inputFile => { for (int tryCount = 0; ; ++tryCount) { var ret = string.Format( tryCount == 0 ? "{0}" : "{0} ({1})", inputFile.LogSource.GetShortDisplayNameWithAnnotation(), tryCount ); if (usedRoleInstanceNames.Add(ret)) { return(ret); } } }; var noMessagingEvents = Task.FromResult(new List <M.Event>()); var chromeDebugLogs = Enumerable.Empty <NodeInfo>() .Concat( inputFiles .Where(f => f.LogSource.Provider.Factory == postprocessorsRegistry.ChromeDebugLog.LogProviderFactory) .Select(inputFile => { var reader = (new CDL.Reader(ljModel.Postprocessing.TextLogParser, inputFile.CancellationToken)).Read(inputFile.LogFileName, inputFile.ProgressHandler); IPrefixMatcher prefixMatcher = ljModel.Postprocessing.CreatePrefixMatcher(); var nodeId = new NodeId("chrome-debug", getUniqueRoleInstanceName(inputFile)); var matchedMessages = reader.MatchTextPrefixes(prefixMatcher).Multiplex(); var webRtcStateInspector = new CDL.WebRtcStateInspector(prefixMatcher); var processIdDetector = new CDL.ProcessIdDetector(); var nodeDetectionTokenTask = (new CDL.NodeDetectionTokenSource(processIdDetector, webRtcStateInspector)).GetToken(matchedMessages); return(new NodeInfo( new[] { inputFile.LogSource }, nodeId, matchedMessages, null, noMessagingEvents, nodeDetectionTokenTask )); }) ) .ToList(); var webRtcInternalsDumps = Enumerable.Empty <NodeInfo>() .Concat( inputFiles .Where(f => f.LogSource.Provider.Factory == postprocessorsRegistry.WebRtcInternalsDump.LogProviderFactory) .Select(inputFile => { var reader = (new WRD.Reader(ljModel.Postprocessing.TextLogParser, inputFile.CancellationToken)).Read(inputFile.LogFileName, inputFile.ProgressHandler); IPrefixMatcher prefixMatcher = ljModel.Postprocessing.CreatePrefixMatcher(); var nodeId = new NodeId("webrtc-int", getUniqueRoleInstanceName(inputFile)); var matchedMessages = WRD.Helpers.MatchPrefixes(reader, prefixMatcher).Multiplex(); var webRtcStateInspector = new WRD.WebRtcStateInspector(prefixMatcher); var nodeDetectionTokenTask = (new WRD.NodeDetectionTokenSource(webRtcStateInspector)).GetToken(matchedMessages); return(new NodeInfo( new[] { inputFile.LogSource }, nodeId, matchedMessages, null, noMessagingEvents, nodeDetectionTokenTask )); }) ) .ToList(); var chromeDriverLogs = Enumerable.Empty <NodeInfo>() .Concat( inputFiles .Where(f => f.LogSource.Provider.Factory == postprocessorsRegistry.ChromeDriver.LogProviderFactory) .Select(inputFile => { var reader = (new CD.Reader(ljModel.Postprocessing.TextLogParser, inputFile.CancellationToken)).Read(inputFile.LogFileName, inputFile.ProgressHandler); IPrefixMatcher prefixMatcher = ljModel.Postprocessing.CreatePrefixMatcher(); var nodeId = new NodeId("webrtc-int", getUniqueRoleInstanceName(inputFile)); var matchedMessages = reader.MatchTextPrefixes(prefixMatcher).Multiplex(); var nodeDetectionTokenTask = (new CD.NodeDetectionTokenSource(new CD.ProcessIdDetector(prefixMatcher), prefixMatcher)).GetToken(matchedMessages); return(new NodeInfo( new[] { inputFile.LogSource }, nodeId, matchedMessages, null, noMessagingEvents, nodeDetectionTokenTask )); }) ) .ToList(); var tasks = new List <Task>(); tasks.AddRange(chromeDebugLogs.Select(l => l.SameNodeDetectionTokenTask)); tasks.AddRange(chromeDebugLogs.Select(l => l.MultiplexingEnumerable.Open())); tasks.AddRange(webRtcInternalsDumps.Select(l => l.SameNodeDetectionTokenTask)); tasks.AddRange(webRtcInternalsDumps.Select(l => l.MultiplexingEnumerable.Open())); tasks.AddRange(chromeDriverLogs.Select(l => l.SameNodeDetectionTokenTask)); tasks.AddRange(chromeDriverLogs.Select(l => l.MultiplexingEnumerable.Open())); await Task.WhenAll(tasks); var allLogs = Enumerable.Empty <NodeInfo>() .Concat(chromeDebugLogs) .Concat(webRtcInternalsDumps) .Concat(chromeDriverLogs) .ToArray(); var fixedConstraints = allLogs .GroupBy(l => l.SameNodeDetectionTokenTask.Result, new SameNodeEqualityComparer()) .SelectMany(group => LinqUtils.ZipWithNext(group).Select(pair => new NodesConstraint() { Node1 = pair.Key.NodeId, Node2 = pair.Value.NodeId, Value = pair.Value.SameNodeDetectionTokenTask.Result.DetectSameNode(pair.Key.SameNodeDetectionTokenTask.Result).TimeDiff })) .ToList(); var allowInstacesMergingForRoles = new HashSet <string>(); ICorrelator correlator = ljModel.Postprocessing.CreateCorrelator(); var correlatorSolution = await correlator.Correlate( allLogs.ToDictionary(i => i.NodeId, i => (IEnumerable <M.Event>)i.MessagesTask.Result), fixedConstraints, allowInstacesMergingForRoles ); var nodeIdToLogSources = (from l in allLogs from ls in l.LogSources select new { L = l.NodeId, Ls = ls }) .ToLookup(i => i.L, i => i.Ls); var grouppedLogsReport = new StringBuilder(); foreach (var group in allLogs.Where(g => g.LogSources.Length > 1)) { if (grouppedLogsReport.Length == 0) { grouppedLogsReport.AppendLine(); grouppedLogsReport.AppendLine("Groupped logs info:"); } grouppedLogsReport.AppendLine(string.Format( " - {0} were groupped to represent node {1}", string.Join(", ", group.LogSources.Select(ls => '\"' + ls.GetShortDisplayNameWithAnnotation() + '\"')), group.NodeId)); } var timeOffsets = (from ns in correlatorSolution.NodeSolutions from ls in nodeIdToLogSources[ns.Key] select new { Sln = ns.Value, Ls = ls }) .ToDictionary(i => i.Ls, i => i.Sln); await modelThreadSync.Invoke(() => { foreach (var ls in ljModel.SourcesManager.Items) { NodeSolution sln; if (timeOffsets.TryGetValue(ls, out sln)) { ITimeOffsetsBuilder builder = ljModel.SourcesManager.CreateTimeOffsetsBuilder(); builder.SetBaseOffset(sln.BaseDelta); if (sln.TimeDeltas != null) { foreach (var d in sln.TimeDeltas) { builder.AddOffset(d.At, d.Delta); } } ls.TimeOffsets = builder.ToTimeOffsets(); } } }); var correlatedLogsConnectionIds = postprocessorsManager.GetCorrelatableLogsConnectionIds(inputFiles.Select(i => i.LogSource)); foreach (var inputFile in inputFiles) { NodeSolution sln; if (!timeOffsets.TryGetValue(inputFile.LogSource, out sln)) { continue; } (new CorrelatorPostprocessorOutput(sln, correlatedLogsConnectionIds)).Save(inputFile.OutputFileName); } return(new CorrelatorPostprocessorRunSummary(correlatorSolution.Success, correlatorSolution.CorrelationLog + grouppedLogsReport.ToString())); }