Beispiel #1
0
 private void AnalysisMessageRelatedActivityRoot(Activity activity)
 {
     if (activity != null && ActivityAnalyzerHelper.IsMessageRelatedActivity(activity))
     {
         if (activity.ActivityType == ActivityType.MessageActivity)
         {
             InternalAnalysisActivityParents(activity, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH);
         }
         else if (activity.ActivityType == ActivityType.ConnectionActivity)
         {
             AnalysisMessageRelatedActivityParents(activity, null, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH);
         }
         else
         {
             InternalAnalysisActivityParents(activity, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH);
         }
         List <TraceRecord> list = activity.LoadTraceRecords(isLoadActivityBoundary: true);
         foreach (TraceRecord item in list)
         {
             if (item.IsTransfer)
             {
                 if (item.ActivityID == activity.Id && !parsedActivities.Contains(item.RelatedActivityID) && !suppressedActivityIds.Contains(item.RelatedActivityID))
                 {
                     suppressedActivityIds.Add(item.RelatedActivityID);
                 }
                 if (item.RelatedActivityID == activity.Id && !parsedActivities.Contains(item.ActivityID) && !suppressedActivityIds.Contains(item.ActivityID))
                 {
                     suppressedActivityIds.Add(item.ActivityID);
                 }
             }
         }
         SaveTargetTraceRecords(activity, list);
     }
 }
Beispiel #2
0
 private void ProbingErrorsInView()
 {
     CollectUnexpandedTransfers();
     if (unexpandedTransferOutControls.Count != 0)
     {
         TraceRecordCellControl traceRecordCellControl = null;
         foreach (TraceRecordCellControl unexpandedTransferOutControl in unexpandedTransferOutControls)
         {
             if (unexpandedTransferOutControl.ExpandingState == ExpandingState.Collapsed)
             {
                 TraceRecordSetSeverityLevel severityLevel = TraceRecordSetSeverityLevel.Normal;
                 TraceRecord firstErrorTrace = null;
                 ActivityAnalyzerHelper.DetectErrorOrWarningOnActivity(base.CurrentDataSource.Activities[unexpandedTransferOutControl.CurrentTraceRecordItem.CurrentTraceRecord.RelatedActivityID], base.CurrentDataSource.Activities, null, null, true, true, ref severityLevel, ref firstErrorTrace, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH2);
                 if (severityLevel != 0)
                 {
                     unexpandedTransferOutControl.CurrentTraceRecordItem.SeverityLevel = severityLevel;
                     if (traceRecordCellControl == null)
                     {
                         traceRecordCellControl = unexpandedTransferOutControl;
                         base.Container.ScrollControlIntoView(traceRecordCellControl, isCenter: true);
                     }
                 }
             }
         }
     }
 }
 internal void AppendExpandingTransfer(TraceRecord trace, ExpandingLevel level)
 {
     if (trace != null && trace.IsTransfer && trace.DataSource.Activities.ContainsKey(trace.RelatedActivityID))
     {
         Dictionary <string, Activity> dictionary = new Dictionary <string, Activity>();
         ActivityAnalyzerHelper.DetectPossibleParentActivities(trace.DataSource.Activities[trace.RelatedActivityID], trace.DataSource.Activities, dictionary, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH2, null);
         List <long> list = new List <long>();
         foreach (TraceRecord value in collapsingTransfers.Values)
         {
             if (value.RelatedActivityID == trace.RelatedActivityID && collapsingTransfers.ContainsKey(value.TraceID))
             {
                 list.Add(value.TraceID);
             }
             else if (dictionary.ContainsKey(value.RelatedActivityID))
             {
                 list.Add(value.TraceID);
             }
         }
         foreach (long item in list)
         {
             collapsingTransfers.Remove(item);
         }
         if (!expandingTransfers.ContainsKey(trace.TraceID))
         {
             expandingTransfers.Add(trace.TraceID, trace);
         }
         if (!expandingTransferTraceLevel.ContainsKey(trace.TraceID))
         {
             expandingTransferTraceLevel.Add(trace.TraceID, level);
         }
     }
 }
Beispiel #4
0
 private void AnalysisRootActivity(Activity rootActivity)
 {
     if (rootActivity != null)
     {
         if (ActivityAnalyzerHelper.IsHostRelatedActivity(rootActivity))
         {
             AnalysisHostActivityRoot(rootActivity);
         }
         else if (ActivityAnalyzerHelper.IsMessageRelatedActivity(rootActivity))
         {
             AnalysisMessageRelatedActivityRoot(rootActivity);
         }
         else
         {
             InternalAnalysisActivityParents(rootActivity, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH);
             List <TraceRecord> traces          = rootActivity.LoadTraceRecords(isLoadActivityBoundary: true);
             List <Activity>    childActivities = ActivityAnalyzerHelper.GetChildActivities(rootActivity.Id, traces, AllActivities, null);
             if (childActivities != null)
             {
                 foreach (Activity item in childActivities)
                 {
                     if (!suppressedActivityIds.Contains(item.Id))
                     {
                         suppressedActivityIds.Add(item.Id);
                     }
                 }
             }
             SaveTargetTraceRecords(rootActivity, traces);
         }
     }
 }
Beispiel #5
0
 private void AnalysisHostActivityRoot(Activity activity)
 {
     if (activity != null && ActivityAnalyzerHelper.IsHostRelatedActivity(activity))
     {
         List <string> relatedHostActivityIdentifiers = null;
         foreach (ExecutionInfo value in ActivityAnalyzerHelper.GetActivityExecutions(activity, null).Values)
         {
             List <TraceRecord> list      = activity.LoadTraceRecords(true, value);
             Activity           activity2 = ActivityAnalyzerHelper.FindRootHostActivity(activity, AllActivities, value, out relatedHostActivityIdentifiers);
             if (activity2 != null)
             {
                 AnalysisHostActivityChild(activity2, value, relatedHostActivityIdentifiers);
             }
             TraceRecord directParentActivityTransferInTrace = ActivityAnalyzerHelper.GetDirectParentActivityTransferInTrace(activity.Id, list, AllActivities, value);
             foreach (TraceRecord item in list)
             {
                 if (item.IsTransfer)
                 {
                     if (!suppressedActivityIds.Contains(item.ActivityID) && !parsedActivities.Contains(item.ActivityID) && item.ActivityID != ActiveActivity.Id && (directParentActivityTransferInTrace == null || directParentActivityTransferInTrace.ActivityID != item.ActivityID))
                     {
                         suppressedActivityIds.Add(item.ActivityID);
                     }
                     else if (!suppressedActivityIds.Contains(item.RelatedActivityID) && !parsedActivities.Contains(item.RelatedActivityID) && item.RelatedActivityID != ActiveActivity.Id && (directParentActivityTransferInTrace == null || directParentActivityTransferInTrace.ActivityID != item.RelatedActivityID))
                     {
                         suppressedActivityIds.Add(item.RelatedActivityID);
                     }
                 }
             }
             SaveTargetTraceRecords(activity, list);
             InternalAnalysisActivityParents(activity, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH);
         }
     }
 }
Beispiel #6
0
 private void SuppressAllChildActivities(Activity activity, int depth, Dictionary <string, List <long> > expandedActivityToTraceIdsMap, TraceRecord collapsingTrace)
 {
     if (activity != null && depth < ActivityAnalyzerHelper.MAX_ACTIVITY_TREE_DEPTH && expandedActivityToTraceIdsMap != null)
     {
         if (!suppressedActivityIds.Contains(activity.Id) && !expandedActivityToTraceIdsMap.ContainsKey(activity.Id))
         {
             suppressedActivityIds.Add(activity.Id);
         }
         foreach (ExecutionInfo value in ActivityAnalyzerHelper.GetActivityExecutions(activity, null).Values)
         {
             ActivityAnalyzerHelper.GetDirectParentActivityTransferInTrace(activity.Id, null, AllActivities, value);
             foreach (Activity childActivity in ActivityAnalyzerHelper.GetChildActivities(activity.Id, null, AllActivities, value))
             {
                 SuppressAllChildActivities(childActivity, depth + 1, expandedActivityToTraceIdsMap, collapsingTrace);
             }
         }
     }
 }
 internal void AppendCollapsingTransfer(TraceRecord trace)
 {
     if (trace != null && trace.IsTransfer && trace.DataSource.Activities.ContainsKey(trace.RelatedActivityID))
     {
         Dictionary <string, Activity> dictionary = new Dictionary <string, Activity>();
         dictionary.Add(trace.RelatedActivityID, trace.DataSource.Activities[trace.RelatedActivityID]);
         ActivityAnalyzerHelper.DetectAllChildActivities(trace.RelatedActivityID, trace.DataSource.Activities, dictionary, null, ActivityAnalyzerHelper.INIT_ACTIVITY_TREE_DEPTH);
         List <long> list = new List <long>();
         foreach (TraceRecord value in expandingTransfers.Values)
         {
             if (value.RelatedActivityID == trace.RelatedActivityID && expandingTransfers.ContainsKey(value.TraceID))
             {
                 list.Add(value.TraceID);
             }
             else if (dictionary.ContainsKey(value.RelatedActivityID))
             {
                 list.Add(value.TraceID);
             }
         }
         foreach (string key in dictionary.Keys)
         {
             if (expandingActivities.ContainsKey(key))
             {
                 expandingActivities.Remove(key);
             }
         }
         foreach (long item in list)
         {
             expandingTransfers.Remove(item);
             expandingTransferTraceLevel.Remove(item);
         }
         if (!collapsingTransfers.ContainsKey(trace.TraceID))
         {
             collapsingTransfers.Add(trace.TraceID, trace);
         }
     }
 }
Beispiel #8
0
 private void InternalAnalysisActivityParents(Activity activity, int depth, ExecutionInfo execution)
 {
     if (activity != null && depth < ActivityAnalyzerHelper.MAX_ACTIVITY_TREE_DEPTH)
     {
         List <TraceRecord> list = null;
         list = activity.LoadTraceRecords(isLoadActivityBoundary: true);
         Dictionary <int, ExecutionInfo> activityExecutions = ActivityAnalyzerHelper.GetActivityExecutions(activity, list);
         foreach (int key in activityExecutions.Keys)
         {
             if (execution == null || execution.ExecutionID == key)
             {
                 TraceRecord directParentActivityTransferInTrace = ActivityAnalyzerHelper.GetDirectParentActivityTransferInTrace(activity.Id, list, AllActivities, activityExecutions[key]);
                 if (directParentActivityTransferInTrace != null && AllActivities.ContainsKey(directParentActivityTransferInTrace.ActivityID))
                 {
                     List <TraceRecord> list2 = new List <TraceRecord>();
                     list2.Add(directParentActivityTransferInTrace);
                     if (suppressedActivityIds.Contains(directParentActivityTransferInTrace.ActivityID))
                     {
                         suppressedActivityIds.Remove(directParentActivityTransferInTrace.ActivityID);
                     }
                     TraceRecord backwardTransferInTrace = ActivityAnalyzerHelper.GetBackwardTransferInTrace(directParentActivityTransferInTrace.ActivityID, directParentActivityTransferInTrace.RelatedActivityID, list, AllActivities, activityExecutions[key]);
                     if (backwardTransferInTrace != null)
                     {
                         list2.Add(backwardTransferInTrace);
                         if (suppressedActivityIds.Contains(backwardTransferInTrace.ActivityID))
                         {
                             suppressedActivityIds.Remove(backwardTransferInTrace.ActivityID);
                         }
                     }
                     InternalAnalysisActivityParents(AllActivities[directParentActivityTransferInTrace.ActivityID], depth + 1, activityExecutions[key]);
                     SaveTargetTraceRecords(AllActivities[directParentActivityTransferInTrace.ActivityID], list2);
                 }
             }
         }
     }
 }
Beispiel #9
0
 private void AnalysisHostActivityChild(Activity activity, ExecutionInfo executionInfo, List <string> relatedHostActivityIdentifiers)
 {
     if (activity != null && executionInfo != null && ActivityAnalyzerHelper.IsHostRelatedActivity(activity) && !suppressedActivityIds.Contains(activity.Id))
     {
         List <TraceRecord> list  = activity.LoadTraceRecords(true, executionInfo);
         List <TraceRecord> list2 = new List <TraceRecord>();
         foreach (TraceRecord item in list)
         {
             if (item.IsTransfer && item.ActivityID == activity.Id && ActivityAnalyzerHelper.IsHostRelatedActivity(AllActivities[item.RelatedActivityID]) && !suppressedActivityIds.Contains(item.RelatedActivityID))
             {
                 string hostActivityNameIdentifier = ActivityAnalyzerHelper.GetHostActivityNameIdentifier(AllActivities[item.RelatedActivityID]);
                 if (relatedHostActivityIdentifiers.Contains(hostActivityNameIdentifier) && item.Execution.ExecutionID == executionInfo.ExecutionID)
                 {
                     list2.Add(item);
                     if (ActiveActivity.Id != item.RelatedActivityID)
                     {
                         suppressedActivityIds.Add(item.RelatedActivityID);
                     }
                 }
             }
         }
         SaveTargetTraceRecords(activity, list2);
     }
 }
Beispiel #10
0
 public HorzBundTitleControl(ActivityTraceModeAnalyzer analyzer, IWindowlessControlContainer container)
 {
     if (analyzer != null)
     {
         InitializeComponent();
         this.container = container;
         Label value = new Label
         {
             AutoSize  = false,
             Dock      = DockStyle.Bottom,
             Height    = 1,
             BackColor = Utilities.GetColor(ApplicationColors.TitleBorder)
         };
         base.Controls.Add(value);
         WindowlessControlScale currentScale = container.GetCurrentScale();
         int num  = HorzBundRowControl.GetTimeBoxSize(currentScale).Width + HorzBundRowControl.GetDefaultBlank(currentScale);
         int num2 = num + ExecutionCellControl.GetDefaultBlank(currentScale);
         int num3 = num;
         foreach (ExecutionColumnItem executionColumnItem in analyzer.ExecutionColumnItems)
         {
             int        num4       = TraceRecordCellControl.GetControlSize(currentScale).Width *executionColumnItem.ActivityColumnCount + ExecutionCellControl.GetDefaultBlock(currentScale) * (executionColumnItem.ActivityColumnCount - 1) + 2 * ExecutionCellControl.GetDefaultBlank(currentScale);
             PictureBox pictureBox = new PictureBox();
             toolTip.SetToolTip(pictureBox, (string)pictureBox.Tag);
             pictureBox.Location    = new Point(num, 0);
             pictureBox.BorderStyle = BorderStyle.None;
             pictureBox.Image       = processTitleBackImage;
             pictureBox.SizeMode    = PictureBoxSizeMode.StretchImage;
             pictureBox.Size        = new Size(num4, GetDefaultVSize(currentScale));
             mainPanel.Controls.Add(pictureBox);
             num  += num4 + HorzBundRowControl.GetDefaultBlock(currentScale);
             num3 += num4;
             Label label = new Label();
             if (TraceViewerForm.IsThreadExecutionMode)
             {
                 label.Text = executionColumnItem.CurrentExecutionInfo.ProcessName + SR.GetString("CF_LeftB") + executionColumnItem.CurrentExecutionInfo.ThreadID + SR.GetString("CF_RightB");
             }
             else
             {
                 label.Text = executionColumnItem.CurrentExecutionInfo.ProcessName;
             }
             label.Font      = GetDefaultFont(currentScale);
             label.TextAlign = ContentAlignment.MiddleCenter;
             label.Dock      = DockStyle.Fill;
             label.BackColor = Color.Transparent;
             toolTip.SetToolTip(label, executionColumnItem.CurrentExecutionInfo.ToString());
             pictureBox.Controls.Add(label);
             for (int i = 0; i < executionColumnItem.ActivityColumnCount; i++)
             {
                 Activity currentActivity     = executionColumnItem[i].CurrentActivity;
                 Label    label2              = new Label();
                 string   activityDisplayName = TraceViewerForm.GetActivityDisplayName(currentActivity);
                 toolTip.SetToolTip(label2, activityDisplayName);
                 int       index     = -1;
                 ImageList imageList = null;
                 if (container.GetCurrentScale() != WindowlessControlScale.XSmall)
                 {
                     if (executionColumnItem[i].CurrentActivity != null && executionColumnItem[i].CurrentActivity.ActivityType == ActivityType.RootActivity)
                     {
                         imageList = TraceViewerForm.GetImageFromImageList(Images.RootActivity, out index);
                     }
                     else if (executionColumnItem[i].CurrentActivity != null && ActivityAnalyzerHelper.IsHostRelatedActivity(executionColumnItem[i].CurrentActivity))
                     {
                         imageList = ((executionColumnItem[i].CurrentActivity.ActivityType != ActivityType.ListenActivity) ? TraceViewerForm.GetImageFromImageList(Images.HostActivityIcon, out index) : TraceViewerForm.GetImageFromImageList(Images.ListenActivity, out index));
                     }
                     else if (executionColumnItem[i].CurrentActivity != null && ActivityAnalyzerHelper.IsMessageRelatedActivity(executionColumnItem[i].CurrentActivity))
                     {
                         imageList = TraceViewerForm.GetImageFromImageList(Images.MessageActivityIcon, out index);
                         if (executionColumnItem[i].CurrentActivity.ActivityType == ActivityType.UserCodeExecutionActivity)
                         {
                             imageList = TraceViewerForm.GetImageFromImageList(Images.ExecutionActivityIcon, out index);
                         }
                         else if (executionColumnItem[i].CurrentActivity.ActivityType == ActivityType.ConnectionActivity)
                         {
                             imageList = TraceViewerForm.GetImageFromImageList(Images.ConnectionActivityIcon, out index);
                         }
                     }
                     else
                     {
                         imageList = TraceViewerForm.GetImageFromImageList(Images.DefaultActivityIcon, out index);
                     }
                 }
                 if (index != -1 && imageList != null)
                 {
                     label2.ImageList  = imageList;
                     label2.ImageIndex = index;
                     label2.ImageAlign = ContentAlignment.MiddleCenter;
                 }
                 else
                 {
                     label2.Text = SR.GetString("SL_ATitle");
                 }
                 label2.BackColor    = Color.Transparent;
                 label2.DoubleClick += lblActivity_DoubleClick;
                 label2.Tag          = currentActivity;
                 label2.Font         = GetDefaultFont(currentScale);
                 label2.BorderStyle  = BorderStyle.None;
                 label2.TextAlign    = ContentAlignment.TopCenter;
                 label2.Location     = new Point(num2, GetDefaultVSize(currentScale));
                 label2.Size         = new Size(TraceRecordCellControl.GetControlSize(currentScale).Width, GetDefaultVSize(currentScale));
                 SetupContextMenuForActivityTitle(label2, executionColumnItem[i], analyzer, currentScale);
                 mainPanel.Controls.Add(label2);
                 num2 += TraceRecordCellControl.GetControlSize(currentScale).Width + ExecutionCellControl.GetDefaultBlock(currentScale);
             }
             num2 -= ExecutionCellControl.GetDefaultBlock(currentScale) - ExecutionCellControl.GetDefaultBlank(currentScale);
             num2 += HorzBundRowControl.GetDefaultBlock(currentScale) + ExecutionCellControl.GetDefaultBlank(currentScale);
         }
         if (analyzer.ExecutionColumnItems.Count > 1)
         {
             num3 += HorzBundRowControl.GetDefaultBlock(currentScale) * (analyzer.ExecutionColumnItems.Count - 1);
         }
         lblDate.Font     = new Font(WindowlessControlBase.CreateFont(HorzBundRowControl.GetFontSize(currentScale)), FontStyle.Bold);
         lblDate.Width    = HorzBundRowControl.GetTimeBoxSize(currentScale).Width;
         lblDate.Height   = GetDefaultHSize(currentScale);
         lblDate.Location = new Point(0, 10);
         container.RegisterExtentionEventListener(OnWindowlessControlExtentionEvent);
         base.Size = new Size(num3, GetDefaultHSize(currentScale));
     }
 }
Beispiel #11
0
 private void AnalysisMessageRelatedActivityParents(Activity activity, Activity childMessageActivity, int depth)
 {
     if (activity != null && depth < ActivityAnalyzerHelper.MAX_ACTIVITY_TREE_DEPTH)
     {
         List <TraceRecord> list = null;
         list = activity.LoadTraceRecords(isLoadActivityBoundary: true);
         Dictionary <int, ExecutionInfo> activityExecutions = ActivityAnalyzerHelper.GetActivityExecutions(activity, list);
         foreach (int key in activityExecutions.Keys)
         {
             if (activity.ActivityType == ActivityType.ConnectionActivity && childMessageActivity != null)
             {
                 TraceRecord directParentActivityTransferInTrace = ActivityAnalyzerHelper.GetDirectParentActivityTransferInTrace(activity.Id, list, AllActivities, activityExecutions[key]);
                 if (directParentActivityTransferInTrace != null)
                 {
                     List <TraceRecord> list2 = new List <TraceRecord>();
                     list2.Add(directParentActivityTransferInTrace);
                     Queue <TraceRecord> queue = new Queue <TraceRecord>();
                     bool flag = false;
                     foreach (TraceRecord item in list)
                     {
                         if (item.TraceID != directParentActivityTransferInTrace.TraceID)
                         {
                             if (item.IsTransfer && item.ActivityID == activity.Id)
                             {
                                 if (item.RelatedActivityID == childMessageActivity.Id)
                                 {
                                     flag = true;
                                 }
                                 else
                                 {
                                     if (flag)
                                     {
                                         break;
                                     }
                                     queue.Clear();
                                 }
                             }
                             else if (item.IsTransfer && item.RelatedActivityID == activity.Id)
                             {
                                 if (item.RelatedActivityID == childMessageActivity.Id && flag)
                                 {
                                     queue.Enqueue(item);
                                     break;
                                 }
                             }
                             else
                             {
                                 queue.Enqueue(item);
                             }
                         }
                     }
                     while (queue.Count != 0)
                     {
                         list2.Add(queue.Dequeue());
                     }
                     TraceRecord backwardTransferInTrace = ActivityAnalyzerHelper.GetBackwardTransferInTrace(directParentActivityTransferInTrace.ActivityID, directParentActivityTransferInTrace.RelatedActivityID, list, AllActivities, activityExecutions[key]);
                     if (backwardTransferInTrace != null)
                     {
                         list2.Add(backwardTransferInTrace);
                     }
                     if (AllActivities.ContainsKey(directParentActivityTransferInTrace.ActivityID))
                     {
                         AnalysisMessageRelatedActivityParents(AllActivities[directParentActivityTransferInTrace.ActivityID], childMessageActivity, depth + 1);
                         SaveTargetTraceRecords(AllActivities[directParentActivityTransferInTrace.ActivityID], list2);
                     }
                 }
             }
             else
             {
                 TraceRecord directParentActivityTransferInTrace2 = ActivityAnalyzerHelper.GetDirectParentActivityTransferInTrace(activity.Id, list, AllActivities, activityExecutions[key]);
                 if (directParentActivityTransferInTrace2 != null)
                 {
                     List <TraceRecord> list3 = new List <TraceRecord>();
                     list3.Add(directParentActivityTransferInTrace2);
                     TraceRecord backwardTransferInTrace2 = ActivityAnalyzerHelper.GetBackwardTransferInTrace(directParentActivityTransferInTrace2.ActivityID, directParentActivityTransferInTrace2.RelatedActivityID, list, AllActivities, activityExecutions[key]);
                     if (backwardTransferInTrace2 != null)
                     {
                         list3.Add(backwardTransferInTrace2);
                     }
                     if (AllActivities.ContainsKey(directParentActivityTransferInTrace2.ActivityID))
                     {
                         AnalysisMessageRelatedActivityParents(AllActivities[directParentActivityTransferInTrace2.ActivityID], childMessageActivity, depth + 1);
                         SaveTargetTraceRecords(AllActivities[directParentActivityTransferInTrace2.ActivityID], list3);
                     }
                 }
             }
         }
     }
 }