public void SetTopMethodsData()
        {
            var row = 0;
            var topMethodsByMemory = _activeSession.SessionModel.GetTopMethodsByMemory();

            if (topMethodsByMemory.Methods.Count > 0)
            {
                ListsGrid.RowDefinitions.Add(new RowDefinition
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                var x = new TopMethodsView()
                {
                    Margin = new Thickness(4),
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    Header     = "Top Methods by Memory",
                    Inclusive  = false,
                    FilterType = StatisticsType.Memory
                };
                x.SetInputSource(topMethodsByMemory);
                ListsGrid.Children.Add(x);
                Grid.SetRow(x, row++);
                Grid.SetColumn(x, 0);
            }

            var topMethodsByTime = _activeSession.SessionModel.GetTopMethodsByTime();

            if (topMethodsByTime.Methods.Count > 0)
            {
                ListsGrid.RowDefinitions.Add(new RowDefinition
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                var x = new TopMethodsView()
                {
                    Margin = new Thickness(4),
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    Header     = "Top Methods by Time",
                    Inclusive  = false,
                    FilterType = StatisticsType.Time
                };
                x.SetInputSource(topMethodsByTime);
                ListsGrid.Children.Add(x);
                Grid.SetRow(x, row++);
                Grid.SetColumn(x, 0);
            }

            var topLinesBySamples = _activeSession.SessionModel.GetTopLinesBySamples();

            if (topLinesBySamples.Lines.Count > 0)
            {
                ListsGrid.RowDefinitions.Add(new RowDefinition
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                var x = new TopLinesView()
                {
                    Margin = new Thickness(4),
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    Header     = "Top Lines",
                    Inclusive  = true,
                    FilterType = StatisticsType.Sample,
                };
                x.SetItemsSource(topLinesBySamples);
                x.MouseDoubleClick += TopLines_MouseDoubleClick;
                ListsGrid.Children.Add(x);
                Grid.SetRow(x, row++);
                Grid.SetColumn(x, 0);
            }

            var topLinesByMemory = _activeSession.SessionModel.GetTopLinesByMemory();

            if (topLinesByMemory.Lines.Count > 0)
            {
                ListsGrid.RowDefinitions.Add(new RowDefinition
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                var x = new TopLinesView()
                {
                    Margin = new Thickness(4),
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    Header     = "Top Lines By Memory",
                    Inclusive  = true,
                    FilterType = StatisticsType.Sample
                };
                x.SetItemsSource(topLinesByMemory);
                x.MouseDoubleClick += TopLinesyMem_MouseDoubleClick;
                ListsGrid.Children.Add(x);
                Grid.SetRow(x, row);
                Grid.SetColumn(x, 0);
            }
        }
Example #2
0
        private void UpdateControls(IActiveSession activeSession, bool updateTreeInput)
        {
            ListsGrid1.RowDefinitions.Clear();
            ListsGrid1.Children.Clear();

            var row     = 0;
            var methods =
                activeSession.SessionModel.GetTopMethods(activeSession.CurrentThreadId, activeSession.StatisticsType);

            if (methods.Methods.Count > 0)
            {
                ListsGrid1.RowDefinitions.Add(new RowDefinition
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                _topMethods.SetInputSource(methods);
                ListsGrid1.Children.Add(_topMethods);
                Grid.SetRow(_topMethods, row++);
                Grid.SetColumn(_topMethods, 0);

                ListsGrid1.RowDefinitions.Add(new RowDefinition
                {
                    Height = GridLength.Auto
                });
                var splitter = new GridSplitter
                {
                    Height = 5,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Center,
                };
                ListsGrid1.Children.Add(splitter);
                Grid.SetRow(splitter, row++);
                Grid.SetColumn(splitter, 0);
                Grid.SetColumn(splitter, 0);
            }

            ListsGrid1.RowDefinitions.Add(new RowDefinition
            {
                Height = new GridLength(1, GridUnitType.Star)
            });
            ListsGrid1.Children.Add(_callTree);
            Grid.SetRow(_callTree, row);
            Grid.SetColumn(_callTree, 0);
            if (updateTreeInput)
            {
                _callTree.SetItemsSource(activeSession.SessionModel.GetCallTree(activeSession.CurrentThreadId),
                                         activeSession.StatisticsType);
            }
            else
            {
                _callTree.StatisticsType = activeSession.StatisticsType;
            }


            ListsGrid2.RowDefinitions.Clear();
            ListsGrid2.Children.Clear();

            row = 0;
            var paths = activeSession.SessionModel.GetHotPathes(activeSession.CurrentThreadId, activeSession.StatisticsType);

            if (paths.Methods.Count > 0)
            {
                ListsGrid2.RowDefinitions.Add(new RowDefinition
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                _hotPathes.SetItemsSource(paths);
                ListsGrid2.Children.Add(_hotPathes);
                Grid.SetRow(_hotPathes, row);
                Grid.SetColumn(_hotPathes, 0);
            }

            _sourceLines = activeSession.SessionModel.GetTopLines(activeSession.CurrentThreadId, activeSession.StatisticsType);
            TopLines.SetItemsSource(_sourceLines);
        }