private bool HilightEdge(PipelineDiagnostics.ReceiverDiagnostics receiverDiagnostics) { switch (this.model.VisualizationObject.Highlight) { case PipelineDiagnosticsVisualizationObject.HighlightCondition.None: return(false); case PipelineDiagnosticsVisualizationObject.HighlightCondition.UnlimitedDeliveryPolicy: return(receiverDiagnostics.DeliveryPolicyName.StartsWith(nameof(DeliveryPolicy.Unlimited))); case PipelineDiagnosticsVisualizationObject.HighlightCondition.LatestMessageDeliveryPolicy: return(receiverDiagnostics.DeliveryPolicyName.StartsWith(nameof(DeliveryPolicy.LatestMessage))); case PipelineDiagnosticsVisualizationObject.HighlightCondition.ThrottleDeliveryPolicy: return(receiverDiagnostics.DeliveryPolicyName.StartsWith(nameof(DeliveryPolicy.Throttle))); case PipelineDiagnosticsVisualizationObject.HighlightCondition.SynchronousOrThrottleDeliveryPolicy: return(receiverDiagnostics.DeliveryPolicyName.StartsWith(nameof(DeliveryPolicy.SynchronousOrThrottle))); case PipelineDiagnosticsVisualizationObject.HighlightCondition.LatencyConstrainedDeliveryPolicy: return(receiverDiagnostics.DeliveryPolicyName.StartsWith(nameof(DeliveryPolicy.LatencyConstrained))); case PipelineDiagnosticsVisualizationObject.HighlightCondition.QueueSizeConstrainedDeliveryPolicy: return(receiverDiagnostics.DeliveryPolicyName.StartsWith(nameof(DeliveryPolicy.QueueSizeConstrained))); case PipelineDiagnosticsVisualizationObject.HighlightCondition.ThrottledReceivers: return(receiverDiagnostics.Throttled); default: throw new ArgumentException($"Unknown highlight condition: {this.model.VisualizationObject.Highlight}"); } }
private void UpdateSelectedEdge(PipelineDiagnostics.ReceiverDiagnostics input, Edge edge, bool clicked) { if (clicked && this.selectedEdgeId == input.Id) { // toggle unselected edge.Attr.LineWidth = this.model.Config.EdgeLineThickness; // unselect current this.SelectedEdgeDetails = string.Empty; this.selectedEdge = null; this.selectedEdgeId = -1; this.view.Update(); return; } // new edge selected if (this.selectedEdge != null) { this.selectedEdge.Attr.LineWidth = this.model.Config.EdgeLineThickness; // unselect previous } edge.Attr.LineWidth = this.model.Config.EdgeLineThickness * 2; // select current this.selectedEdge = edge; this.selectedEdgeId = input.Id; var sb = new StringBuilder(); sb.Append($"Type: {input.Type}" + Environment.NewLine); sb.Append($"Message Size (avg): {input.MessageSizeHistory.AverageSize():0}" + Environment.NewLine); sb.Append($"Queue Size: {input.QueueSize}" + Environment.NewLine); sb.Append($"Processed Count: {input.ProcessedCount}" + Environment.NewLine); sb.Append($"Dropped Count: {input.DroppedCount}" + Environment.NewLine); sb.Append($"Latency at Emitter (avg): {input.MessageLatencyAtEmitterHistory.AverageTime().TotalMilliseconds:0.###}ms" + Environment.NewLine); sb.Append($"Latency at Receiver (avg): {input.MessageLatencyAtReceiverHistory.AverageTime().TotalMilliseconds:0.###}ms" + Environment.NewLine); sb.Append($"Processing Time (avg): {input.ProcessingTimeHistory.AverageTime().TotalMilliseconds:0.###}ms" + Environment.NewLine); this.SelectedEdgeDetails = sb.ToString(); this.view.Update(); }
private Edge BuildVisualEdge(Node source, Node target, PipelineDiagnostics.ReceiverDiagnostics input, Func <PipelineDiagnostics.ReceiverDiagnostics, double> statsSelector) { var stats = statsSelector != null ? $" ({statsSelector(input):0.#})" : string.Empty; var edge = this.BuildVisualEdge(source, target, input.Source.Name, input.ReceiverName, stats, input.DeliveryPolicyName, Style.Solid); edge.UserData = input; edge.Label.UserData = edge; return(edge); }
private Edge BuildVisualEdge(Node source, Node target, PipelineDiagnostics.ReceiverDiagnostics input, Func <PipelineDiagnostics.ReceiverDiagnostics, double> statsSelector) { var edge = new Edge(source, target, ConnectionToGraph.Connected); edge.UserData = input; edge.Attr.Color = this.EdgeColor; edge.Attr.LineWidth = this.model.Config.EdgeLineThickness; var stats = statsSelector != null ? $" ({statsSelector(input):0.#})" : string.Empty; edge.LabelText = $"{input.Name}{stats}"; edge.Label.FontColor = this.LabelColorLight; edge.Label.UserData = edge; return(edge); }
private bool AddVisualEdge(Node source, Node target, PipelineDiagnostics.ReceiverDiagnostics input, Graph graph, Func <PipelineDiagnostics.ReceiverDiagnostics, double> statsSelector) { if (source != null && target != null) { var edge = this.BuildVisualEdge(source, target, input, statsSelector); graph.AddPrecalculatedEdge(edge); if (input.Id == this.model.SelectedEdgeId) { this.UpdateSelectedEdge(input, graph, false); return(true); } } return(false); }
private bool AddVisualEdge(int sourceId, int targetId, PipelineDiagnostics.ReceiverDiagnostics input, Graph graph, Func <PipelineDiagnostics.ReceiverDiagnostics, double> statsSelector) { var source = graph.FindNode($"n{sourceId}"); var target = graph.FindNode($"n{targetId}"); if (source != null && target != null) { var edge = this.BuildVisualEdge(source, target, input, statsSelector); graph.AddPrecalculatedEdge(edge); if (input.Id == this.selectedEdgeId) { this.UpdateSelectedEdge(input, edge, false); return(true); } } return(false); }
private void UpdateSelectedEdge(PipelineDiagnostics.ReceiverDiagnostics input, Graph graph, bool clicked) { var edge = GetEdgeById(input.Id, graph); if (clicked && this.model.SelectedEdgeId == input.Id) { // toggle unselected edge.Attr.LineWidth = this.model.VisualizationObject.EdgeLineThickness; // unselect current this.model.SelectedEdgeDetails = string.Empty; this.model.SelectedEdgeId = -1; this.view.Update(true); return; } // new edge selected if (this.model.SelectedEdgeId != -1) { var previousEdge = GetEdgeById(this.model.SelectedEdgeId, graph); if (previousEdge != null) { previousEdge.Attr.LineWidth = this.model.VisualizationObject.EdgeLineThickness; // unselect previous } } edge.Attr.LineWidth = this.model.VisualizationObject.EdgeLineThickness * 2; // select current this.model.SelectedEdgeId = input.Id; var sb = new StringBuilder(); sb.Append($"Type: {TypeSpec.Simplify(input.TypeName)}" + Environment.NewLine); sb.Append($"Message Size (avg): {input.MessageSize:0}" + Environment.NewLine); sb.Append($"Queue Size: {input.QueueSize:0.###}" + Environment.NewLine); sb.Append($"Processed Count: {input.ProcessedCount}" + Environment.NewLine); sb.Append($"Processed/Time: {input.ProcessedPerTimeSpan:0.###}" + Environment.NewLine); sb.Append($"Dropped Count: {input.DroppedCount}" + Environment.NewLine); sb.Append($"Dropped/Time: {input.DroppedPerTimeSpan:0.###}" + Environment.NewLine); sb.Append($"Latency at Emitter (avg): {input.MessageLatencyAtEmitter:0.###}ms" + Environment.NewLine); sb.Append($"Latency at Receiver (avg): {input.MessageLatencyAtReceiver:0.###}ms" + Environment.NewLine); sb.Append($"Processing Time (avg): {input.ProcessingTime:0.###}ms" + Environment.NewLine); sb.Append($"Delivery Policy: {input.DeliveryPolicyName}" + Environment.NewLine); this.model.SelectedEdgeDetails = sb.ToString(); this.view.Update(clicked); }
private bool AddVisualEdge(int sourceId, int targetId, PipelineDiagnostics.ReceiverDiagnostics input, Graph graph, Func <PipelineDiagnostics.ReceiverDiagnostics, double> statsSelector) { return(this.AddVisualEdge(graph.FindNode($"n{sourceId}"), graph.FindNode($"n{targetId}"), input, graph, statsSelector)); }