コード例 #1
0
        void InitThreadList(FrameGroup group)
        {
            List <ThreadRow> rows = new List <ThreadRow>();

            if (group != null)
            {
                rows.Add(new HeaderThreadRow(group)
                {
                    GradientTop    = (ThreadViewControl.OptickAlternativeBackground as SolidColorBrush).Color,
                    GradientBottom = (ThreadViewControl.OptickBackground as SolidColorBrush).Color,
                    TextColor      = Colors.Gray,
                    Header         = new ThreadFilterView(),
                });

                ChartRow cpuCoreChart = GenerateCoreChart(group);
                if (cpuCoreChart != null)
                {
                    cpuCoreChart.IsExpanded     = false;
                    cpuCoreChart.ExpandChanged += CpuCoreChart_ExpandChanged;
                    cpuCoreChart.ChartHover    += Row_ChartHover;
                    rows.Add(cpuCoreChart);
                }

                List <EventsThreadRow> threadRows = GenerateThreadRows(group);
                foreach (EventsThreadRow row in threadRows)
                {
                    if (row.Description.Origin == ThreadDescription.Source.Core)
                    {
                        row.IsVisible = false;
                        coreRows.Add(row);
                    }
                }
                rows.AddRange(threadRows);
            }

            ThreadViewControl.InitRows(rows, group != null ? group.Board.TimeSlice : null);

            List <ITick> frames = null;

            if (Group != null && Group.Frames != null && Group.Frames[FrameList.Type.CPU] != null)
            {
                FrameList list = Group.Frames[FrameList.Type.CPU];
                frames = list.Events.ConvertAll(frame => frame as ITick);
            }
            else if (Group != null)
            {
                frames = new List <ITick>();
                long step = Durable.MsToTick(1000.0);
                for (long timestamp = Group.Board.TimeSlice.Start; timestamp < Group.Board.TimeSlice.Finish; timestamp += step)
                {
                    frames.Add(new Tick()
                    {
                        Start = timestamp
                    });
                }
            }

            ThreadViewControl.InitForegroundLines(frames);
        }
コード例 #2
0
        private void ShowCallstacksButton_Checked(object sender, RoutedEventArgs e)
        {
            CallStackReason reason = 0;

            CallstackFilter.ForEach(filter => reason |= filter.IsChecked ? filter.Reason : 0);

            ThreadViewControl.Scroll.DrawCallstacks = reason;
            ThreadViewControl.UpdateSurface();
        }
コード例 #3
0
 public void Clear()
 {
     if (null != id2row)
     {
         foreach (var row in id2row)
         {
             row.Value.Clear();
         }
         id2row.Clear();
     }
     ThreadViewControl.Clear();
 }
コード例 #4
0
        private void CpuCoreChart_ExpandChanged(ThreadRow row)
        {
            if (row.IsExpanded)
            {
                if (!Group.IsCoreDataGenerated)
                {
                    bool isVisible = row.IsExpanded;
                    Task.Run(() =>
                    {
                        row.SetBusy(true);
                        Group.GenerateRealCoreThreads();
                        ThreadViewControl.ReinitRows(coreRows);
                        row.SetBusy(false);
                        Application.Current.Dispatcher.Invoke(new Action(() => coreRows.ForEach(core => core.IsVisible = isVisible)));
                    });
                    return;
                }
            }

            coreRows.ForEach(core => core.IsVisible = row.IsExpanded);
            ThreadViewControl.UpdateRows();
        }
コード例 #5
0
        void InitThreadList(SamplingFrame frame)
        {
            Frame = frame;

            List <ThreadRow> rows = new List <ThreadRow>();

            if (frame != null)
            {
                List <Entry> entries = new List <Entry>();

                SamplingNode root = frame.Root;

                BuildEntryList(entries, root, 0.0);

                EventFrame eventFrame = new EventFrame(new FrameHeader()
                {
                    Start = 0, Finish = Durable.MsToTick(root.Duration)
                }, entries, frame.Group);
                ThreadData threadData = new ThreadData(null)
                {
                    Events = new List <EventFrame> {
                        eventFrame
                    }
                };
                EventsThreadRow row = new EventsThreadRow(frame.Group, new ThreadDescription()
                {
                    Name = "Sampling Node"
                }, threadData, Settings);
                row.LimitMaxDepth   = false;
                row.EventNodeHover += Row_EventNodeHover;
                rows.Add(row);
                ThreadViewControl.Scroll.ViewUnit.Width = 1.0;
                ThreadViewControl.InitRows(rows, eventFrame.Header);
            }
            else
            {
                ThreadViewControl.InitRows(rows, null);
            }
        }
コード例 #6
0
 private void ShowCallstacksButton_Unchecked(object sender, RoutedEventArgs e)
 {
     ThreadViewControl.Scroll.DrawCallstacks = 0;
     ThreadViewControl.UpdateSurface();
 }
コード例 #7
0
 private void ShowFrameLinesButton_Click(object sender, RoutedEventArgs e)
 {
     ThreadViewControl.ShowFrameLines = ShowFrameLinesButton.IsChecked.GetValueOrDefault(true);
     ThreadViewControl.UpdateSurface();
 }
コード例 #8
0
 private void ShowSyncWorkButton_Click(object sender, RoutedEventArgs e)
 {
     ThreadViewControl.Scroll.SyncDraw = ShowSyncWorkButton.IsChecked.Value ? ThreadScroll.SyncDrawType.Work : ThreadScroll.SyncDrawType.Wait;
     ThreadViewControl.UpdateSurface();
 }
コード例 #9
0
 public void Highlight(IEnumerable <ThreadViewControl.Selection> items, bool focus = true)
 {
     ThreadViewControl.Highlight(items, focus);
 }