Browse Source

Moved SharpDevelopElementHost to Profiler.AddIn

Added new functionality to Profiler
rearranged ProfileExecutableForm
fixed bug in TimeLineControl
smaller bug fixes

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3914 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
be8ba32292
  1. 12
      src/AddIns/Misc/Profiler/Controller/Profiler.cs
  2. 12
      src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs
  3. 1
      src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj
  4. 6
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/ProfileExecutable.cs
  5. 43
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml
  6. 11
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/General.cs
  7. 8
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml
  8. 34
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml.cs
  9. 5
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs
  10. 32
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs
  11. 1
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/SharpDevelopElementHost.cs
  12. 11
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs
  13. 4
      src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml
  14. 9
      src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs
  15. 16
      src/AddIns/Misc/Profiler/Frontend/Controls/TimeLineControl.cs
  16. 17
      src/AddIns/Misc/Profiler/Frontend/Gui/Window1.xaml.cs
  17. 36
      src/AddIns/Misc/Profiler/Profiler.sln
  18. 7
      src/AddIns/Misc/Profiler/TODO.txt
  19. 6
      src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj

12
src/AddIns/Misc/Profiler/Controller/Profiler.cs

@ -247,11 +247,6 @@ namespace ICSharpCode.Profiler.Controller @@ -247,11 +247,6 @@ namespace ICSharpCode.Profiler.Controller
fullView = file.MapView(0, profilerOptions.SharedMemorySize);
if (is64Bit)
InitializeHeader64();
else
InitializeHeader32();
this.dataWriter.ProcessorFrequency = GetProcessorFrequency();
this.logger = new Thread(new ParameterizedThreadStart(Logging));
@ -274,7 +269,7 @@ namespace ICSharpCode.Profiler.Controller @@ -274,7 +269,7 @@ namespace ICSharpCode.Profiler.Controller
memHeader32->HeapOffset = Align(memHeader32->ThreadDataOffset + threadDataSize);
memHeader32->HeapLength = profilerOptions.SharedMemorySize - memHeader32->HeapOffset;
memHeader32->ProcessorFrequency = GetProcessorFrequency();
memHeader32->DoNotProfileDotnetInternals = !profilerOptions.ProfileDotNetInternals;
memHeader32->DoNotProfileDotnetInternals = profilerOptions.DoNotProfileDotNetInternals;
memHeader32->CombineRecursiveFunction = profilerOptions.CombineRecursiveFunction;
if ((Int32)(fullView.Pointer + memHeader32->HeapOffset) % 8 != 0) {
@ -460,6 +455,11 @@ namespace ICSharpCode.Profiler.Controller @@ -460,6 +455,11 @@ namespace ICSharpCode.Profiler.Controller
{
VerifyAccess();
if (is64Bit)
InitializeHeader64();
else
InitializeHeader32();
isRunning = true;
RegisterProfiler();

12
src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs

@ -15,20 +15,20 @@ namespace ICSharpCode.Profiler.Controller @@ -15,20 +15,20 @@ namespace ICSharpCode.Profiler.Controller
public class ProfilerOptions
{
/// <summary>
/// Defines a default size of the shared memory.
/// Defines the default size of the shared memory.
/// </summary>
public const int SHARED_MEMORY_SIZE = 64 * 1024 * 1024; // 64 mb
bool enableDC;
bool profileDotNetInternals;
bool dotNotProfileDotNetInternals;
bool combineRecursiveFunction;
int sharedMemorySize;
/// <summary>
/// Gets whether .NET internal calls are profiled or not.
/// </summary>
public bool ProfileDotNetInternals {
get { return profileDotNetInternals; }
public bool DoNotProfileDotNetInternals {
get { return dotNotProfileDotNetInternals; }
}
/// <summary>
@ -59,7 +59,7 @@ namespace ICSharpCode.Profiler.Controller @@ -59,7 +59,7 @@ namespace ICSharpCode.Profiler.Controller
{
this.enableDC = enableDC;
this.sharedMemorySize = sharedMemorySize;
this.profileDotNetInternals = profileDotNetInternals;
this.dotNotProfileDotNetInternals = profileDotNetInternals;
this.combineRecursiveFunction = combineRecursiveFunction;
}
@ -67,7 +67,7 @@ namespace ICSharpCode.Profiler.Controller @@ -67,7 +67,7 @@ namespace ICSharpCode.Profiler.Controller
/// Creates default ProfilerOptions.
/// </summary>
public ProfilerOptions()
: this(true, SHARED_MEMORY_SIZE, true, false)
: this(true, SHARED_MEMORY_SIZE, false, false)
{
}
}

1
src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj

@ -112,6 +112,7 @@ @@ -112,6 +112,7 @@
</Compile>
<Compile Include="Src\Views\ProfilerDisplayBinding.cs">
</Compile>
<Compile Include="Src\Views\SharpDevelopElementHost.cs" />
<Compile Include="Src\Views\WpfViewer.cs" />
</ItemGroup>
<ItemGroup>

6
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/ProfileExecutable.cs

@ -5,16 +5,18 @@ @@ -5,16 +5,18 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.Profiler.Controller.Data;
using System;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.Profiler.AddIn.Views;
using ICSharpCode.Profiler.Controller.Data;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using Microsoft.Build.BuildEngine;
using System.Windows.Interop;
namespace ICSharpCode.Profiler.AddIn.Commands
{
@ -32,7 +34,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands @@ -32,7 +34,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands
public override void Run()
{
ProfileExecutableForm form = new ProfileExecutableForm();
new WindowInteropHelper(form).Owner = WorkbenchSingleton.MainForm.Handle;
form.ShowDialog();
}
}

43
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml

@ -1,19 +1,36 @@ @@ -1,19 +1,36 @@
<Window x:Class="ICSharpCode.Profiler.AddIn.Dialogs.ProfileExecutableForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="195" Width="609" Title="Profile executable" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ShowInTaskbar="False" ResizeMode="NoResize">
Title="Profile executable" WindowStartupLocation="CenterScreen"
WindowStyle="ToolWindow" ShowInTaskbar="False" ResizeMode="NoResize" SizeToContent="WidthAndHeight">
<Grid Background="#FFD4D0C8">
<Label HorizontalAlignment="Left" Margin="12,46,0,0" Width="145" Height="24" VerticalAlignment="Top">Path to executable:</Label>
<TextBox Margin="163,44,56,0" Name="txtExePath" Height="26" VerticalAlignment="Top" />
<Button Height="26" Margin="0,45.138,12,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="38" Click="btnSelectFileClick">...</Button>
<Label Height="26" HorizontalAlignment="Left" Margin="12,76,0,0" VerticalAlignment="Top" Width="145">Working directory:</Label>
<TextBox Height="26" Margin="163,77,56,0" Name="txtWorkingDir" VerticalAlignment="Top" />
<Button Height="26" HorizontalAlignment="Right" Margin="0,76,12,0" VerticalAlignment="Top" Width="38" Click="btnSelectDirClick">...</Button>
<Label Height="26" HorizontalAlignment="Left" Margin="12,108,0,0" VerticalAlignment="Top" Width="145">Command-Line Arguments:</Label>
<TextBlock Height="36" Margin="12,12,12,0" VerticalAlignment="Top"
Text="Select the path of the executable you want to profile. Optionally you can specify working directory and command line arguments to start the process." TextWrapping="Wrap" />
<TextBox Margin="163,109,12,0" Name="txtArgs" VerticalAlignment="Top" Height="24" />
<Button Height="27" HorizontalAlignment="Left" Margin="173,0,0,6" VerticalAlignment="Bottom" Width="105" Click="btnStartClick">Start Profiling</Button>
<Button Height="27" Margin="0,0,204,6" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="99" Click="btnCancelClick">Cancel</Button>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock TextWrapping="Wrap" Grid.ColumnSpan="3" Margin="3">
Select the path of the executable you want to profile.<LineBreak />
Optionally you can specify working directory and command line arguments to start the process.
</TextBlock>
<Label Grid.Row="1">Path to executable:</Label>
<TextBox Margin="3" Name="txtExePath" Grid.Column="1" Grid.Row="1" />
<Button Margin="3" Padding="5,0,5,0" Grid.Column="2" Grid.Row="1" Click="btnSelectFileClick">...</Button>
<Label Grid.Row="2">Working directory:</Label>
<TextBox Margin="3" Name="txtWorkingDir" Grid.Row="2" Grid.Column="1" />
<Button Margin="3" Padding="5,0,5,0" Grid.Column="2" Grid.Row="2" Click="btnSelectDirClick">...</Button>
<Label Grid.Row="3">Command-Line Arguments:</Label>
<TextBox Margin="3" Name="txtArgs" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="3" />
<StackPanel Grid.ColumnSpan="3" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Margin="3" Padding="5,0,5,0" Click="btnStartClick">Start Profiling</Button>
<Button Margin="3" Padding="5,0,5,0" Click="btnCancelClick">Cancel</Button>
</StackPanel>
</Grid>
</Window>

11
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/General.cs

@ -36,8 +36,10 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels @@ -36,8 +36,10 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels
public override void LoadPanelContents()
{
panel.Load(properties.Get("EnableDC", true),
properties.Get("SharedMemorySize", ProfilerOptions.SHARED_MEMORY_SIZE) / 1024 / 1024);
panel.SetOptionValue<bool>("EnableDC", !properties.Get("EnableDC", true));
panel.SetOptionValue<double>("SharedMemorySize", properties.Get("SharedMemorySize", ProfilerOptions.SHARED_MEMORY_SIZE) / 1024 / 1024);
panel.SetOptionValue<bool>("DoNotProfileNetInternals", properties.Get("DoNotProfileNetInternals", false));
panel.SetOptionValue<bool>("CombineRecursiveFunction", properties.Get("CombineRecursiveFunction", false));
base.LoadPanelContents();
}
@ -45,7 +47,8 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels @@ -45,7 +47,8 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels
{
properties.Set("EnableDC", !panel.GetOptionValue<bool>("EnableDC"));
properties.Set("SharedMemorySize", (int)panel.GetOptionValue<double>("SharedMemorySize") * 1024 * 1024);
properties.Set("DoNotProfileNetInternals", panel.GetOptionValue<bool>("DoNotProfileNetInternals"));
properties.Set("CombineRecursiveFunction", panel.GetOptionValue<bool>("CombineRecursiveFunction"));
return base.StorePanelContents();
}
@ -53,7 +56,7 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels @@ -53,7 +56,7 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels
{
return new ProfilerOptions(properties.Get("EnableDC", true),
properties.Get("SharedMemorySize", ProfilerOptions.SHARED_MEMORY_SIZE),
!properties.Get("PorfileDotNetInternals", true),
properties.Get("DoNotProfileNetInternals", false),
properties.Get("CombineRecursiveFunction", false)
);
}

8
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml

@ -5,9 +5,11 @@ @@ -5,9 +5,11 @@
<GroupBox Header="Data Collection" Margin="0,0,0,0" Name="groupBox1">
<Grid>
<CheckBox Height="14" Margin="6,6,6,0" Name="chkEnableDC" VerticalAlignment="Top">Only collect data at the end of the session.</CheckBox>
<Slider Margin="170,26,94,0" Name="slSharedMemorySize" IsDirectionReversed="False" TickPlacement="Both" Minimum="64" Maximum="512" TickFrequency="64" SmallChange="64" LargeChange="128" IsSnapToTickEnabled="True" />
<Label Margin="6,26,0,0" Name="label1" Height="33.723" HorizontalAlignment="Left" VerticalAlignment="Top" Width="163">Size of temporary storage file:</Label>
<TextBlock HorizontalAlignment="Left" Margin="250,35,24,5" Width="50" Text="{Binding Value, ElementName=slSharedMemorySize, StringFormat=\{0\} MB}" />
<Slider Margin="170,26,94,0" Name="slSharedMemorySize" IsDirectionReversed="False" TickPlacement="Both" Minimum="64" Maximum="512" TickFrequency="64" SmallChange="64" LargeChange="128" IsSnapToTickEnabled="True" Height="34" VerticalAlignment="Top" />
<Label Margin="1,26,0,0" Name="label1" Height="24" HorizontalAlignment="Left" VerticalAlignment="Top" Width="163">Size of temporary storage file:</Label>
<TextBlock HorizontalAlignment="Right" Margin="0,34,38,0" Width="50" Text="{Binding Value, ElementName=slSharedMemorySize, StringFormat=\{0\} MB}" Height="16" VerticalAlignment="Top" />
<CheckBox Margin="6,66,6,0" Name="chkDoNotProfileNetInternals" Height="15" VerticalAlignment="Top">Do not profile .NET internal calls.</CheckBox>
<CheckBox Margin="6,87,6,0" Name="chkCombineRecursiveCalls" Height="16.723" VerticalAlignment="Top">Combine recursive calls.</CheckBox>
</Grid>
</GroupBox>
</Grid>

34
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml.cs

@ -26,12 +26,6 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels @@ -26,12 +26,6 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels
InitializeComponent();
}
public void Load(bool enableDC, int sharedMemorySize)
{
this.slSharedMemorySize.Value = sharedMemorySize;
this.chkEnableDC.IsChecked = !enableDC;
}
public T GetOptionValue<T>(string name)
{
object o;
@ -43,11 +37,39 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels @@ -43,11 +37,39 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels
case "EnableDC":
o = this.chkEnableDC.IsChecked;
break;
case "DoNotProfileNetInternals":
o = this.chkDoNotProfileNetInternals.IsChecked;
break;
case "CombineRecursiveFunction":
o = this.chkCombineRecursiveCalls.IsChecked;
break;
default:
throw new NotSupportedException("value '" + name + "' is not supported!");
}
return (T)o;
}
public void SetOptionValue<T>(string name, T value)
{
object o = value;
switch (name) {
case "SharedMemorySize":
this.slSharedMemorySize.Value = (double)o;
break;
case "EnableDC":
this.chkEnableDC.IsChecked = (bool)o;
break;
case "DoNotProfileNetInternals":
this.chkDoNotProfileNetInternals.IsChecked = (bool)o;
break;
case "CombineRecursiveFunction":
this.chkCombineRecursiveCalls.IsChecked = (bool)o;
break;
default:
throw new NotSupportedException("value '" + name + "' is not supported!");
}
}
}
}

5
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs

@ -66,16 +66,19 @@ namespace ICSharpCode.Profiler.AddIn @@ -66,16 +66,19 @@ namespace ICSharpCode.Profiler.AddIn
void FinishSession()
{
using (AsynchronousWaitDialog dlg = AsynchronousWaitDialog.ShowWaitDialog("Preparing for analysis", true)) {
if (database != null) {
database.WriteTo(writer, progress => true); // TODO : change default impl to good user interface notification
database.WriteTo(writer, progress => !dlg.IsCancelled);
writer.Close();
database.Close();
} else {
writer.Close();
}
if (!dlg.IsCancelled)
OnRunFinished(EventArgs.Empty);
}
}
public void Run()
{

32
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs

@ -1,10 +1,11 @@ @@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Windows.Threading;
@ -44,6 +45,8 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -44,6 +45,8 @@ namespace ICSharpCode.Profiler.AddIn.Views
this.dummyTab.Header = new Image { Source = PresentationResourceService.GetImage("Icons.16x16.NewDocumentIcon").Source, Height = 16, Width = 16 };
this.CommandBindings.Add(new CommandBinding(ApplicationCommands.SelectAll, ExecuteSelectAll, CanExecuteSelectAll));
InitializeLastItems();
InitializeOldTabs();
}
@ -51,11 +54,36 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -51,11 +54,36 @@ namespace ICSharpCode.Profiler.AddIn.Views
void timeLine_RangeChanged(object sender, RangeEventArgs e)
{
foreach (TabItem item in this.tabView.Items) {
if (item.Content != null)
if (item != null && item.Content != null)
((QueryView)item.Content).SetRange(e.StartIndex, e.EndIndex);
}
}
void ExecuteSelectAll(object sender, ExecutedRoutedEventArgs e)
{
DoSelectAll();
e.Handled = true;
}
void DoSelectAll()
{
if (this.timeLine.IsEnabled) {
this.timeLine.SelectedStartIndex = 0;
this.timeLine.SelectedEndIndex = this.timeLine.ValuesList.Count;
}
}
void CanExecuteSelectAll(object sender, CanExecuteRoutedEventArgs e)
{
CanDoSelectAll(e);
e.Handled = true;
}
void CanDoSelectAll(CanExecuteRoutedEventArgs e)
{
e.CanExecute = this.timeLine.IsEnabled && this.timeLine.ValuesList.Count > 0;
}
void closeButton_Click(object sender, RoutedEventArgs e)
{
int index = tabView.Items.IndexOf(((Button)sender).Tag);

1
src/Main/ICSharpCode.Core.Presentation/SharpDevelopElementHost.cs → src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/SharpDevelopElementHost.cs

@ -17,7 +17,6 @@ namespace ICSharpCode.Core.Presentation @@ -17,7 +17,6 @@ namespace ICSharpCode.Core.Presentation
/// <summary>
/// Hosts a WPF element inside a Windows.Forms application.
/// </summary>
// TODO : maybe move this class to ICSharpCode.SharpDevelop as it requires it as a reference
public class SharpDevelopElementHost : ElementHost, IUndoHandler, IClipboardHandler
{
public SharpDevelopElementHost(UIElement child)

11
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs

@ -5,12 +5,13 @@ @@ -5,12 +5,13 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.Profiler.Controller.Data;
using System;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using ICSharpCode.Profiler.Controller;
using ICSharpCode.Profiler.Controller.Data;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core.Presentation;
namespace ICSharpCode.Profiler.AddIn.Views
{
@ -22,7 +23,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -22,7 +23,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
public class WpfViewer : AbstractViewContent
{
ProfilingDataProvider provider;
ElementHost host;
SharpDevelopElementHost host;
ProfilerView dataView;
/// <summary>
@ -42,8 +43,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -42,8 +43,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
this.provider = provider;
this.TabPageText = title;
this.TitleName = this.TabPageText;
this.host = new ElementHost();
this.host.Child = dataView = new ProfilerView(this.provider);
this.host = new SharpDevelopElementHost(dataView = new ProfilerView(this.provider));
this.host.Dock = DockStyle.Fill;
}
@ -67,5 +67,4 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -67,5 +67,4 @@ namespace ICSharpCode.Profiler.AddIn.Views
base.Dispose();
}
}
}

4
src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml

@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
<local:TreeListView x:Name="treeView" Grid.Row="2" SelectionMode="Extended">
<ListView.View>
<local:CustomGridView>
<GridViewColumn Header="Name" Width="210">
<GridViewColumn Header="Name" Width="210" x:Name="nameColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<local:CustomGridViewScrollableCell CurrentScrollPosition="{Binding ElementName=treeView, Path=View.CurrentScrollPosition}">
@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Time spent" Width="90">
<GridViewColumn Header="Time spent" Width="110">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Right" Text="{Binding TimeSpent}" />

9
src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs

@ -74,6 +74,7 @@ namespace ICSharpCode.Profiler.Controls @@ -74,6 +74,7 @@ namespace ICSharpCode.Profiler.Controls
if (!string.IsNullOrEmpty(txtSearch.Text) && list.Count > 0) {
CallTreeNodeViewModel result;
// TODO: should we perform search in background?
if (list.First().Search(txtSearch.Text, true, out result)) {
result.IsSelected = true;
if (oldSearchResult != null)
@ -89,10 +90,18 @@ namespace ICSharpCode.Profiler.Controls @@ -89,10 +90,18 @@ namespace ICSharpCode.Profiler.Controls
this.IsVisibleChanged += delegate { this.ExecuteQuery(); };
this.DataContext = this;
this.task = new SingleTask(this.Dispatcher);
this.treeView.SizeChanged += delegate(object sender, SizeChangedEventArgs e) {
if (e.PreviousSize.Width > 0 && e.NewSize.Width > 0) {
nameColumn.Width += (e.NewSize.Width - e.PreviousSize.Width);
}
};
}
public void SetRange(int start, int end)
{
if (this.Provider == null)
return;
this.RangeStart = start;
this.RangeEnd = end;
this.searchRoot = new CallTreeNodeViewModel(this.Provider.GetRoot(start, end), null);

16
src/AddIns/Misc/Profiler/Frontend/Controls/TimeLineControl.cs

@ -39,6 +39,7 @@ namespace ICSharpCode.Profiler.Controls @@ -39,6 +39,7 @@ namespace ICSharpCode.Profiler.Controls
selectedEndIndex = value;
this.InvalidateMeasure();
this.InvalidateVisual();
OnRangeChanged(new RangeEventArgs(selectedStartIndex, selectedEndIndex));
}
}
@ -49,6 +50,7 @@ namespace ICSharpCode.Profiler.Controls @@ -49,6 +50,7 @@ namespace ICSharpCode.Profiler.Controls
selectedStartIndex = value;
this.InvalidateMeasure();
this.InvalidateVisual();
OnRangeChanged(new RangeEventArgs(selectedStartIndex, selectedEndIndex));
}
}
@ -132,7 +134,12 @@ namespace ICSharpCode.Profiler.Controls @@ -132,7 +134,12 @@ namespace ICSharpCode.Profiler.Controls
protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e)
{
this.selectedEndIndex = TransformToIndex(e.GetPosition(this));
int index = TransformToIndex(e.GetPosition(this));
index = (index < 0) ? 0 : index;
index = (index > this.valuesList.Count) ? this.valuesList.Count : index;
this.selectedEndIndex = index;
this.InvalidateMeasure();
this.InvalidateVisual();
this.ReleaseMouseCapture();
@ -141,7 +148,12 @@ namespace ICSharpCode.Profiler.Controls @@ -141,7 +148,12 @@ namespace ICSharpCode.Profiler.Controls
protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e)
{
this.CaptureMouse();
this.selectedStartIndex = this.selectedEndIndex = TransformToIndex(e.GetPosition(this));
int index = TransformToIndex(e.GetPosition(this));
index = (index < 0) ? 0 : index;
index = (index > this.valuesList.Count) ? this.valuesList.Count : index;
this.selectedStartIndex = this.selectedEndIndex = index;
this.InvalidateMeasure();
this.InvalidateVisual();
}

17
src/AddIns/Misc/Profiler/Frontend/Gui/Window1.xaml.cs

@ -147,6 +147,23 @@ namespace ICSharpCode.Profiler.Frontend @@ -147,6 +147,23 @@ namespace ICSharpCode.Profiler.Frontend
this.btnStop.IsEnabled = false;
this.timeLine.IsEnabled = false;
this.treeView.Reporter = new ErrorReporter(HandleError);
this.CommandBindings.Add(new CommandBinding(ApplicationCommands.SelectAll, ExecuteSelectAll, CanExecuteSelectAll));
}
void ExecuteSelectAll(object sender, ExecutedRoutedEventArgs e)
{
if (this.timeLine.IsEnabled) {
this.timeLine.SelectedStartIndex = 0;
this.timeLine.SelectedEndIndex = this.timeLine.ValuesList.Count;
}
e.Handled = true;
}
void CanExecuteSelectAll(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = this.timeLine.IsEnabled && this.timeLine.ValuesList.Count > 0;
e.Handled = true;
}
void HandleError(CompilerError error)

36
src/AddIns/Misc/Profiler/Profiler.sln

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
# SharpDevelop 3.1.0.3882
# SharpDevelop 3.1.0.3895
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5147BA25-8362-481D-8CF9-450096595B7A}"
ProjectSection(SolutionItems) = preProject
TODO.txt = TODO.txt
@ -13,12 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Frontend", "Frontend", "{E0 @@ -13,12 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Frontend", "Frontend", "{E0
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls", "Frontend\Controls\Controls.csproj", "{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddIn", "Frontend\AddIn\AddIn.csproj", "{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchmarkRunner", "Frontend\BenchmarkRunner\BenchmarkRunner.csproj", "{DBEF953E-F7BC-4D54-8A27-B758EC875C49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gui", "Frontend\Gui\Gui.csproj", "{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}"
ProjectSection(ProjectDependencies) = postProject
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}
@ -27,19 +21,25 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gui", "Frontend\Gui\Gui.csp @@ -27,19 +21,25 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gui", "Frontend\Gui\Gui.csp
{778BA9AE-EE77-444F-A0C9-D795BB977C1A} = {778BA9AE-EE77-444F-A0C9-D795BB977C1A}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchmarkRunner", "Frontend\BenchmarkRunner\BenchmarkRunner.csproj", "{DBEF953E-F7BC-4D54-8A27-B758EC875C49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddIn", "Frontend\AddIn\AddIn.csproj", "{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls", "Frontend\Controls\Controls.csproj", "{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{791AE00B-AD96-410A-AAA8-957DDD83C57A}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicodeTest", "Tests\UnicodeTest\UnicodeTest.csproj", "{D336926C-6180-4F62-B88D-E366B240127B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "Tests\Benchmark\Benchmark.csproj", "{F09B6132-5DF9-4E63-BA23-EE82D75CD5B9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Tests", "Tests\Profiler.Tests\Profiler.Tests.csproj", "{068F9531-5D29-49E0-980E-59982A3A0469}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "Tests\HelloWorld\HelloWorld.csproj", "{778BA9AE-EE77-444F-A0C9-D795BB977C1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PauseTest", "Tests\PauseTest\PauseTest.csproj", "{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "Tests\HelloWorld\HelloWorld.csproj", "{778BA9AE-EE77-444F-A0C9-D795BB977C1A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Tests", "Tests\Profiler.Tests\Profiler.Tests.csproj", "{068F9531-5D29-49E0-980E-59982A3A0469}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "Tests\Benchmark\Benchmark.csproj", "{F09B6132-5DF9-4E63-BA23-EE82D75CD5B9}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicodeTest", "Tests\UnicodeTest\UnicodeTest.csproj", "{D336926C-6180-4F62-B88D-E366B240127B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Hook", "Hook\Hook.vcproj", "{68D5EE3B-0C35-4DF1-BD29-6606851A02C1}"
EndProject
@ -173,14 +173,14 @@ Global @@ -173,14 +173,14 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{DBEF953E-F7BC-4D54-8A27-B758EC875C49} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{BDA49550-5ED1-4C6B-B648-657B2CACD8E0} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{F09B6132-5DF9-4E63-BA23-EE82D75CD5B9} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{778BA9AE-EE77-444F-A0C9-D795BB977C1A} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{068F9531-5D29-49E0-980E-59982A3A0469} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{DBEF953E-F7BC-4D54-8A27-B758EC875C49} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{D336926C-6180-4F62-B88D-E366B240127B} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{068F9531-5D29-49E0-980E-59982A3A0469} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{778BA9AE-EE77-444F-A0C9-D795BB977C1A} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{F09B6132-5DF9-4E63-BA23-EE82D75CD5B9} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
EndGlobalSection
EndGlobal

7
src/AddIns/Misc/Profiler/TODO.txt

@ -10,3 +10,10 @@ NEW FEATURES @@ -10,3 +10,10 @@ NEW FEATURES
- Implement a memory profiler
API CLEANUP
(while creating SQLite database from TempFileDatabase)
[18:49:37] Daniel Grunwald says: ich habe gerade profiled, bin fertig, und jetzt passiert nichts sichtbares mehr...
[18:50:10] Daniel Grunwald says: da fehlt ein Fortschrittsbalken, oder wenigstens eine Zeile im Output
[19:51:51] Daniel Grunwald says: wenn ich einen Syntaxfehler in der Query habe, wird keine Fehlermeldung angezeigt
[00:34:02] Daniel Grunwald says: wir verfälschen sowieso
[00:34:27] Daniel Grunwald says: Funktionsaufrufe im Vergleich zu Schleifen -> mit Profiler werden Funktionsaufrufe stark benachteiligt
[00:34:54] Daniel Grunwald says: man könnte versuchen, den eigenen Overhead zu bestimmen und rauszurechnen

6
src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj

@ -76,7 +76,6 @@ @@ -76,7 +76,6 @@
<Compile Include="PixelSnapper.cs" />
<Compile Include="PresentationResourceService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SharpDevelopElementHost.cs" />
<Compile Include="SplitButton.cs" />
<Compile Include="ToolBar\ToolBarButton.cs" />
<Compile Include="ToolBar\ToolBarComboBox.cs" />
@ -84,11 +83,6 @@ @@ -84,11 +83,6 @@
<Compile Include="ToolBar\ToolBarSplitButton.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>

Loading…
Cancel
Save