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

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

@ -15,20 +15,20 @@ namespace ICSharpCode.Profiler.Controller
public class ProfilerOptions public class ProfilerOptions
{ {
/// <summary> /// <summary>
/// Defines a default size of the shared memory. /// Defines the default size of the shared memory.
/// </summary> /// </summary>
public const int SHARED_MEMORY_SIZE = 64 * 1024 * 1024; // 64 mb public const int SHARED_MEMORY_SIZE = 64 * 1024 * 1024; // 64 mb
bool enableDC; bool enableDC;
bool profileDotNetInternals; bool dotNotProfileDotNetInternals;
bool combineRecursiveFunction; bool combineRecursiveFunction;
int sharedMemorySize; int sharedMemorySize;
/// <summary> /// <summary>
/// Gets whether .NET internal calls are profiled or not. /// Gets whether .NET internal calls are profiled or not.
/// </summary> /// </summary>
public bool ProfileDotNetInternals { public bool DoNotProfileDotNetInternals {
get { return profileDotNetInternals; } get { return dotNotProfileDotNetInternals; }
} }
/// <summary> /// <summary>
@ -59,7 +59,7 @@ namespace ICSharpCode.Profiler.Controller
{ {
this.enableDC = enableDC; this.enableDC = enableDC;
this.sharedMemorySize = sharedMemorySize; this.sharedMemorySize = sharedMemorySize;
this.profileDotNetInternals = profileDotNetInternals; this.dotNotProfileDotNetInternals = profileDotNetInternals;
this.combineRecursiveFunction = combineRecursiveFunction; this.combineRecursiveFunction = combineRecursiveFunction;
} }
@ -67,7 +67,7 @@ namespace ICSharpCode.Profiler.Controller
/// Creates default ProfilerOptions. /// Creates default ProfilerOptions.
/// </summary> /// </summary>
public ProfilerOptions() 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 @@
</Compile> </Compile>
<Compile Include="Src\Views\ProfilerDisplayBinding.cs"> <Compile Include="Src\Views\ProfilerDisplayBinding.cs">
</Compile> </Compile>
<Compile Include="Src\Views\SharpDevelopElementHost.cs" />
<Compile Include="Src\Views\WpfViewer.cs" /> <Compile Include="Src\Views\WpfViewer.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

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

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

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

@ -1,19 +1,36 @@
<Window x:Class="ICSharpCode.Profiler.AddIn.Dialogs.ProfileExecutableForm" <Window x:Class="ICSharpCode.Profiler.AddIn.Dialogs.ProfileExecutableForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 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"> <Grid Background="#FFD4D0C8">
<Label HorizontalAlignment="Left" Margin="12,46,0,0" Width="145" Height="24" VerticalAlignment="Top">Path to executable:</Label> <Grid.RowDefinitions>
<TextBox Margin="163,44,56,0" Name="txtExePath" Height="26" VerticalAlignment="Top" /> <RowDefinition Height="Auto" />
<Button Height="26" Margin="0,45.138,12,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="38" Click="btnSelectFileClick">...</Button> <RowDefinition Height="Auto" />
<Label Height="26" HorizontalAlignment="Left" Margin="12,76,0,0" VerticalAlignment="Top" Width="145">Working directory:</Label> <RowDefinition Height="Auto" />
<TextBox Height="26" Margin="163,77,56,0" Name="txtWorkingDir" VerticalAlignment="Top" /> <RowDefinition Height="Auto" />
<Button Height="26" HorizontalAlignment="Right" Margin="0,76,12,0" VerticalAlignment="Top" Width="38" Click="btnSelectDirClick">...</Button> <RowDefinition Height="Auto"/>
<Label Height="26" HorizontalAlignment="Left" Margin="12,108,0,0" VerticalAlignment="Top" Width="145">Command-Line Arguments:</Label> </Grid.RowDefinitions>
<TextBlock Height="36" Margin="12,12,12,0" VerticalAlignment="Top" <Grid.ColumnDefinitions>
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" /> <ColumnDefinition Width="Auto"/>
<TextBox Margin="163,109,12,0" Name="txtArgs" VerticalAlignment="Top" Height="24" /> <ColumnDefinition Width="1*" />
<Button Height="27" HorizontalAlignment="Left" Margin="173,0,0,6" VerticalAlignment="Bottom" Width="105" Click="btnStartClick">Start Profiling</Button> <ColumnDefinition Width="Auto" />
<Button Height="27" Margin="0,0,204,6" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="99" Click="btnCancelClick">Cancel</Button> </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> </Grid>
</Window> </Window>

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

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

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

@ -5,9 +5,11 @@
<GroupBox Header="Data Collection" Margin="0,0,0,0" Name="groupBox1"> <GroupBox Header="Data Collection" Margin="0,0,0,0" Name="groupBox1">
<Grid> <Grid>
<CheckBox Height="14" Margin="6,6,6,0" Name="chkEnableDC" VerticalAlignment="Top">Only collect data at the end of the session.</CheckBox> <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" /> <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="6,26,0,0" Name="label1" Height="33.723" HorizontalAlignment="Left" VerticalAlignment="Top" Width="163">Size of temporary storage file:</Label> <Label Margin="1,26,0,0" Name="label1" Height="24" 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}" /> <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> </Grid>
</GroupBox> </GroupBox>
</Grid> </Grid>

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

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

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

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

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

@ -1,10 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Text;
using System.Linq; using System.Linq;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Threading; using System.Windows.Threading;
@ -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.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(); InitializeLastItems();
InitializeOldTabs(); InitializeOldTabs();
} }
@ -51,11 +54,36 @@ namespace ICSharpCode.Profiler.AddIn.Views
void timeLine_RangeChanged(object sender, RangeEventArgs e) void timeLine_RangeChanged(object sender, RangeEventArgs e)
{ {
foreach (TabItem item in this.tabView.Items) { 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); ((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) void closeButton_Click(object sender, RoutedEventArgs e)
{ {
int index = tabView.Items.IndexOf(((Button)sender).Tag); 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
/// <summary> /// <summary>
/// Hosts a WPF element inside a Windows.Forms application. /// Hosts a WPF element inside a Windows.Forms application.
/// </summary> /// </summary>
// TODO : maybe move this class to ICSharpCode.SharpDevelop as it requires it as a reference
public class SharpDevelopElementHost : ElementHost, IUndoHandler, IClipboardHandler public class SharpDevelopElementHost : ElementHost, IUndoHandler, IClipboardHandler
{ {
public SharpDevelopElementHost(UIElement child) public SharpDevelopElementHost(UIElement child)

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

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

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

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

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

@ -74,6 +74,7 @@ namespace ICSharpCode.Profiler.Controls
if (!string.IsNullOrEmpty(txtSearch.Text) && list.Count > 0) { if (!string.IsNullOrEmpty(txtSearch.Text) && list.Count > 0) {
CallTreeNodeViewModel result; CallTreeNodeViewModel result;
// TODO: should we perform search in background? // TODO: should we perform search in background?
if (list.First().Search(txtSearch.Text, true, out result)) { if (list.First().Search(txtSearch.Text, true, out result)) {
result.IsSelected = true; result.IsSelected = true;
if (oldSearchResult != null) if (oldSearchResult != null)
@ -89,10 +90,18 @@ namespace ICSharpCode.Profiler.Controls
this.IsVisibleChanged += delegate { this.ExecuteQuery(); }; this.IsVisibleChanged += delegate { this.ExecuteQuery(); };
this.DataContext = this; this.DataContext = this;
this.task = new SingleTask(this.Dispatcher); 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) public void SetRange(int start, int end)
{ {
if (this.Provider == null)
return;
this.RangeStart = start; this.RangeStart = start;
this.RangeEnd = end; this.RangeEnd = end;
this.searchRoot = new CallTreeNodeViewModel(this.Provider.GetRoot(start, end), null); 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
selectedEndIndex = value; selectedEndIndex = value;
this.InvalidateMeasure(); this.InvalidateMeasure();
this.InvalidateVisual(); this.InvalidateVisual();
OnRangeChanged(new RangeEventArgs(selectedStartIndex, selectedEndIndex));
} }
} }
@ -49,6 +50,7 @@ namespace ICSharpCode.Profiler.Controls
selectedStartIndex = value; selectedStartIndex = value;
this.InvalidateMeasure(); this.InvalidateMeasure();
this.InvalidateVisual(); this.InvalidateVisual();
OnRangeChanged(new RangeEventArgs(selectedStartIndex, selectedEndIndex));
} }
} }
@ -132,7 +134,12 @@ namespace ICSharpCode.Profiler.Controls
protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e) 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.InvalidateMeasure();
this.InvalidateVisual(); this.InvalidateVisual();
this.ReleaseMouseCapture(); this.ReleaseMouseCapture();
@ -141,7 +148,12 @@ namespace ICSharpCode.Profiler.Controls
protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e) protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e)
{ {
this.CaptureMouse(); 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.InvalidateMeasure();
this.InvalidateVisual(); this.InvalidateVisual();
} }

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

@ -147,6 +147,23 @@ namespace ICSharpCode.Profiler.Frontend
this.btnStop.IsEnabled = false; this.btnStop.IsEnabled = false;
this.timeLine.IsEnabled = false; this.timeLine.IsEnabled = false;
this.treeView.Reporter = new ErrorReporter(HandleError); 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) void HandleError(CompilerError error)

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

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

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

@ -10,3 +10,10 @@ NEW FEATURES
- Implement a memory profiler - Implement a memory profiler
API CLEANUP 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 @@
<Compile Include="PixelSnapper.cs" /> <Compile Include="PixelSnapper.cs" />
<Compile Include="PresentationResourceService.cs" /> <Compile Include="PresentationResourceService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SharpDevelopElementHost.cs" />
<Compile Include="SplitButton.cs" /> <Compile Include="SplitButton.cs" />
<Compile Include="ToolBar\ToolBarButton.cs" /> <Compile Include="ToolBar\ToolBarButton.cs" />
<Compile Include="ToolBar\ToolBarComboBox.cs" /> <Compile Include="ToolBar\ToolBarComboBox.cs" />
@ -84,11 +83,6 @@
<Compile Include="ToolBar\ToolBarSplitButton.cs" /> <Compile Include="ToolBar\ToolBarSplitButton.cs" />
</ItemGroup> </ItemGroup>
<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"> <ProjectReference Include="..\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> <Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name> <Name>ICSharpCode.Core</Name>

Loading…
Cancel
Save