From c7a37f844318a6cb2ec3b1a97662360b6ebd6c18 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 4 Sep 2009 13:25:59 +0000 Subject: [PATCH] - Top 20 displays user code only - Added functionality to expand selected hot paths - fixed percentage of parent git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4877 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Profiler/Controller/Data/CallTreeNode.cs | 9 +++++++++ .../Frontend/AddIn/Src/Views/ProfilerView.xaml | 4 ++-- .../AddIn/Src/Views/ProfilerView.xaml.cs | 2 +- .../Frontend/Controls/CallTreeNodeViewModel.cs | 11 +---------- .../Profiler/Frontend/Controls/QueryView.xaml | 3 ++- .../Frontend/Controls/QueryView.xaml.cs | 17 +++++++++++++++++ 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs b/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs index 1c36a3bf2f..ca61b51764 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs @@ -60,6 +60,15 @@ namespace ICSharpCode.Profiler.Controller.Data } } + /// + /// Gets whether this call is user code. + /// + public virtual bool IsUserCode { + get { + return this.NameMapping.Id > 0; + } + } + /// /// Gets whether the function call started in a previous data set that's not selected. /// diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml index 584d149085..65b9fc792f 100644 --- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml +++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml @@ -25,7 +25,7 @@ - + @@ -40,7 +40,7 @@ - + diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs index 0a2bdd0414..62a69a2f0e 100644 --- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs +++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs @@ -54,7 +54,7 @@ namespace ICSharpCode.Profiler.AddIn.Views InitializeOldTabs(); } - void timeLine_RangeChanged(object sender, RangeEventArgs e) + void TimeLineRangeChanged(object sender, RangeEventArgs e) { foreach (TabItem item in this.tabView.Items) { if (item != null && item.Content != null) diff --git a/src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs b/src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs index ead483394f..936b25add8 100644 --- a/src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs +++ b/src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs @@ -97,7 +97,7 @@ namespace ICSharpCode.Profiler.Controls if (this.parent == null) return 1; else - return (double)this.node.CpuCyclesSpent / (double)GetNodeFromLevel(1).node.CpuCyclesSpent; + return (double)this.node.CpuCyclesSpent / (double)this.parent.node.CpuCyclesSpent; } } @@ -110,15 +110,6 @@ namespace ICSharpCode.Profiler.Controls } } - CallTreeNodeViewModel GetNodeFromLevel(int level) - { - if (this.level > level) { - return this.parent.GetNodeFromLevel(level); - } - - return this; - } - public virtual string TimePercentageOfParentAsText { get { diff --git a/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml b/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml index de3977ef6d..677da8169d 100644 --- a/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml +++ b/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml @@ -119,7 +119,7 @@ - + @@ -142,6 +142,7 @@ + diff --git a/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs b/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs index 9f9c1cdb51..71f6de489c 100644 --- a/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs +++ b/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs @@ -294,6 +294,23 @@ namespace ICSharpCode.Profiler.Controls this.Invalidate(); } + void BtnExpandHotPathSubtreeClick(object sender, RoutedEventArgs e) + { + foreach (CallTreeNodeViewModel node in this.SelectedItems.ToArray()) { + ExpandHotPathItems(node); + } + } + + void ExpandHotPathItems(CallTreeNodeViewModel parent) + { + if (parent.HotPathIndicatorVisibility == Visibility.Visible) { + parent.IsExpanded = true; + + foreach (CallTreeNodeViewModel node in parent.Children) + ExpandHotPathItems(node); + } + } + public ContextMenu TreeViewContextMenu { get { return this.treeView.ContextMenu; } set { this.treeView.ContextMenu = this.ringDiagram.ContextMenu = value; }