void DrawSelection(DirectX.DirectXCanvas canvas) { foreach (Selection selection in SelectionList) { if (selection.Frame != null && selection.Row != null) { ThreadRow row = selection.Row; IDurable intervalTime = selection.Focus == null ? selection.Frame.Header : selection.Focus; Interval intervalPx = Scroll.TimeToPixel(intervalTime); Rect rect = new Rect(intervalPx.Left, row.Offset /*+ 2.0 * RenderParams.BaseMargin*/, intervalPx.Width, row.Height /*- 4.0 * RenderParams.BaseMargin*/); for (int i = 0; i < SelectionBorderCount; ++i) { if (rect.IsEmpty) { break; } rect.Inflate(SelectionBorderStep, SelectionBorderStep); SelectionMesh.AddRect(rect, FrameSelection.Color); } } } SelectionMesh.Update(canvas.RenderDevice); canvas.Draw(SelectionMesh); }
public Interval TimeToPixel(IDurable d) { Interval unit = TimeToUnit(d); double scale = Width * Zoom; return(new Interval((unit.Left - ViewUnit.Left) * scale, unit.Width * scale)); }
public FrameHeader(int threadIndex, int fiberIndex, IDurable duration) { ThreadIndex = threadIndex; FiberIndex = fiberIndex; Start = duration.Start; Finish = duration.Finish; }
public void Highlight(EventFrame frame, IDurable focus) { Group = frame.Group; ThreadRow row = null; id2row.TryGetValue(frame.Header.ThreadIndex, out row); Highlight(new ThreadViewControl.Selection[] { new ThreadViewControl.Selection() { Frame = frame, Focus = focus, Row = row } }); }
public virtual void SetFrame(Data.Frame frame, IDurable node) { if (this.frame != frame) { this.frame = frame; this.DataContext = frame; } else if (node != null) { FocusOnNode(node); } }
public void InitRows(List <ThreadRow> rows, IDurable timeslice) { Rows = rows; if (rows.Count > 0) { Scroll.TimeSlice = new Durable(timeslice.Start, timeslice.Finish); Scroll.Width = surface.ActualWidth * RenderSettings.dpiScaleX; rows.ForEach(row => row.BuildMesh(surface, Scroll)); rows.ForEach(row => row.ExpandChanged += Row_ExpandChanged); rows.ForEach(row => row.VisibilityChanged += Row_VisibilityChanged); } UpdateRows(); }
public override void SetFrame(Data.Frame frame, IDurable node) { if (frame is EventFrame) { if (SourceFrame == frame) { return; } SourceFrame = frame; SamplingFrame samplingFrame = frame.Group.CreateSamplingFrame((frame as EventFrame).RootEntry.Description, CallstackType); base.SetFrame(samplingFrame, null); } else { base.SetFrame(frame, null); } }
public FocusFrameEventArgs(RoutedEvent routedEvent, Data.Frame frame, IDurable focus = null) : base(routedEvent) { Frame = frame; Focus = focus; }
public Interval TimeToUnit(IDurable d) { double durationTicks = TimeSlice.Finish - TimeSlice.Start; return(new Interval((d.Start - TimeSlice.Start) / durationTicks, (d.Finish - d.Start) / durationTicks)); }
public bool FocusOnNode(IDurable focusRange) { if (focusRange == null) { return(false); } if (EventTreeView == null) { return(false); } if (EventTreeView.ItemsSource == null) { return(false); } List <BaseTreeNode> treePath = new List <BaseTreeNode>(); foreach (var node in EventTreeView.ItemsSource) { BaseTreeNode baseTreeNode = node as BaseTreeNode; if (baseTreeNode == null) { continue; } baseTreeNode.ForEach((curNode, level) => { EventNode treeEventNode = curNode as EventNode; if (treeEventNode == null) { return(true); } if (treeEventNode.Entry.Start > focusRange.Finish) { return(false); } if (treeEventNode.Entry.Contains(focusRange)) { treePath.Add(curNode); //find desired node in tree if (treeEventNode.Entry.Start >= focusRange.Start && treeEventNode.Entry.Finish <= focusRange.Finish) { return(false); } } return(true); }); ItemsControl root = EventTreeView; int pathElementsCount = treePath.Count; if (pathElementsCount > 0) { //expand path in tree int index = 0; for (index = 0; index < (pathElementsCount - 1); index++) { BaseTreeNode expandNode = treePath[index]; if (root != null) { root = root.ItemContainerGenerator.ContainerFromItem(expandNode) as ItemsControl; } treePath[index].IsExpanded = true; } BaseTreeNode finalNode = treePath[index]; // select target node finalNode.IsExpanded = false; finalNode.IsSelected = true; // focus on finalNode if (root != null) { root = root.ItemContainerGenerator.ContainerFromItem(finalNode) as ItemsControl; if (root != null) { root.BringIntoView(); } } EventTreeView.InvalidateVisual(); return(true); } } return(false); }
internal bool Contains(IDurable other) { return(Start <= other.Start && Finish >= other.Finish); }
internal bool Intersect(IDurable other) { return(Start <= other.Finish && Finish >= other.Start); }
internal bool Within(IDurable other) { return(Start >= other.Start && Finish <= other.Finish); }
public void AddDurable(IDurable durable) { AddWhile(durable.Do); }
public void SetFrame(Data.Frame frame, IDurable node) { this.frame = frame; Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { frame.Load(); this.DataContext = frame; FocusOnNode(node); })); }