private void ProcessGetContext() { TenantSyncSummary tenantSyncSummary = new TenantSyncSummary(); List <IEnumerable <TenantSyncBatchResults> > list = tenantSyncSummary.Samples as List <IEnumerable <TenantSyncBatchResults> >; this.FindTheRightCookie(); ExProgressRecord exProgressRecord = new ExProgressRecord(1, new LocalizedString("Tenant Sync"), new LocalizedString("Sync Call")); ExProgressRecord exProgressRecord2 = new ExProgressRecord(2, new LocalizedString("Sync Call"), new LocalizedString("GetContext")); exProgressRecord2.ParentActivityId = exProgressRecord.ActivityId; for (int i = 0; i < this.SampleCountForStatistics; i++) { exProgressRecord.CurrentOperation = Strings.GetMsoDiagnosticsProgressIteration(i + 1, this.SampleCountForStatistics); exProgressRecord.PercentComplete = i * 100 / this.SampleCountForStatistics; exProgressRecord.RecordType = ProgressRecordType.Processing; base.WriteProgress(exProgressRecord); byte[] lastCookie = this.Cookie; byte[] lastPageToken = this.PageToken; string contextId = this.ExternalDirectoryOrganizationId; List <TenantSyncBatchResults> list2 = new List <TenantSyncBatchResults>(); list.Add(list2); for (int j = 0; j < this.MaxNumberOfBatches; j++) { exProgressRecord2.CurrentOperation = Strings.GetMsoDiagnosticsProgressBatch(j + 1, this.MaxNumberOfBatches); exProgressRecord2.PercentComplete = j * 100 / this.MaxNumberOfBatches; exProgressRecord2.RecordType = ProgressRecordType.Processing; base.WriteProgress(exProgressRecord2); ExDateTime now = ExDateTime.Now; GetContextResponse context = this.MsoSyncService.SyncProxy.GetContext(new GetContextRequest(lastCookie, contextId, lastPageToken)); TimeSpan responseTime = ExDateTime.Now - now; DirectoryObjectsAndLinks getContextResult = context.GetContextResult; if (getContextResult != null) { TenantSyncBatchResults tenantSyncBatchResults = new TenantSyncBatchResults(getContextResult); tenantSyncBatchResults.Stats.ResponseTime = responseTime; tenantSyncBatchResults.RawResponse = this.MsoSyncService.RawResponse; tenantSyncBatchResults.LastPageToken = lastPageToken; tenantSyncBatchResults.CalculateStats(); list2.Add(tenantSyncBatchResults); contextId = null; lastCookie = null; lastPageToken = getContextResult.NextPageToken; } if (getContextResult == null || !getContextResult.More) { break; } } if (list2.Last <TenantSyncBatchResults>().More) { this.WriteWarning(Strings.GetMsoDiagnosticsMoreDataIsAvailable); } exProgressRecord2.RecordType = ProgressRecordType.Completed; base.WriteProgress(exProgressRecord2); } exProgressRecord.RecordType = ProgressRecordType.Completed; base.WriteProgress(exProgressRecord); tenantSyncSummary.CalculateStats(); base.WriteObject(tenantSyncSummary); }
public void Calculate(TenantSyncBatchResults tenantSyncBatch) { base.Calculate(tenantSyncBatch.Objects, tenantSyncBatch.Links); this.ErrorCount = tenantSyncBatch.Errors.Count <DirectoryObjectError>(); if (TenantSyncBatchStatistics.< Calculate > o__SiteContainer0.< > p__Site1 == null) { TenantSyncBatchStatistics.< Calculate > o__SiteContainer0.< > p__Site1 = CallSite <Func <CallSite, object, SizeAndCountStatistics> > .Create(Binder.Convert(CSharpBinderFlags.None, typeof(SizeAndCountStatistics), typeof(TenantSyncBatchStatistics))); } this.ErrorSize = TenantSyncBatchStatistics.< Calculate > o__SiteContainer0.< > p__Site1.Target(TenantSyncBatchStatistics.< Calculate > o__SiteContainer0.< > p__Site1, SizeAndCountStatistics.Calculate(from o in tenantSyncBatch.Errors select SyncBatchStatisticsBase.SerializedSize(o))); this.ErrorsPerSecond = (double)this.ErrorCount / base.ResponseTime.TotalSeconds; this.ErrorBytesPerSecond = (double)this.ErrorSize.Sum / base.ResponseTime.TotalSeconds; }