private void UpdatePerfCountersBasedOnResults() { this.searchTimer.Stop(); PerformanceCounters.TotalSearchesInProgress.Decrement(); MultiMailboxSearch.GetSearchLatencyPerfCounter(this.criteria.SearchType, (int)this.searchTimer.ElapsedMilliseconds).Increment(); switch (this.criteria.SearchType) { case SearchType.Statistics: PerformanceCounters.AverageStatisticsRequestProcessingTime.IncrementBy(this.searchTimer.ElapsedTicks); PerformanceCounters.AverageStatisticsRequestProcessingTimeBase.Increment(); return; case SearchType.Preview: PerformanceCounters.AveragePreviewRequestProcessingTime.IncrementBy(this.searchTimer.ElapsedTicks); PerformanceCounters.AveragePreviewRequestProcessingTimeBase.Increment(); PerformanceCounters.AverageFailedMailboxesInPreview.IncrementBy((long)this.resultAggregator.PreviewErrors.Count); PerformanceCounters.AverageFailedMailboxesInPreviewBase.Increment(); return; case SearchType.ExpandSources: PerformanceCounters.AveragePreviewAndStatisticsRequestProcessingTime.IncrementBy(this.searchTimer.ElapsedTicks); PerformanceCounters.AveragePreviewAndStatisticsRequestProcessingTimeBase.Increment(); PerformanceCounters.AverageFailedMailboxesInPreview.IncrementBy((long)this.resultAggregator.PreviewErrors.Count); PerformanceCounters.AverageFailedMailboxesInPreviewBase.Increment(); return; default: return; } }
private void StartGroupSearches(Dictionary <GroupId, List <MailboxInfo> > mailboxGroups) { int num = 0; int num2 = 0; this.groups = new List <MailboxSearchGroup>(mailboxGroups.Count); foreach (KeyValuePair <GroupId, List <MailboxInfo> > keyValuePair in mailboxGroups) { if (keyValuePair.Key.GroupType == GroupType.Local) { num++; } else if (keyValuePair.Key.GroupType == GroupType.CrossServer) { num2++; } if (keyValuePair.Key.GroupType != GroupType.SkippedError) { if (keyValuePair.Key.GroupType != GroupType.Local && Util.IsNestedFanoutCall(this.callerInfo)) { this.AddNestedFanoutMailboxesToPreviewErrors(keyValuePair.Value); } else { this.groups.Add(Factory.Current.CreateMailboxSearchGroup(keyValuePair.Key, keyValuePair.Value, this.criteria, this.pagingInfo, this.callerInfo)); } } else { this.AddSkippedMailboxesToPreviewErrors(keyValuePair.Value, keyValuePair.Key.Error); } } this.resultAggregator.ProtocolLog.Add("NumberOfRemoteSearch", num2); MultiMailboxSearch.IncrementGroupPerfCounters(num, num2, mailboxGroups.Count); try { foreach (MailboxSearchGroup mailboxSearchGroup in this.groups) { mailboxSearchGroup.BeginExecuteSearch(new AsyncCallback(this.MailboxSearchGroupCompleted), mailboxSearchGroup); this.scheduledGroups++; } } catch (MultiMailboxSearchException ex) { Factory.Current.GeneralTracer.TraceError <Guid, string>((long)this.GetHashCode(), "Correlation Id:{0}. Hit an unexpected exception during search execution.", this.callerInfo.QueryCorrelationId, ex.ToString()); } finally { if (this.groups.Count == 0) { this.asyncResult.ReportCompletion(); } } }