Browse Source

- finished Options Panels

- bug fixes

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3881 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
274003e760
  1. 6
      src/AddIns/Misc/Profiler/Controller/Profiler.cs
  2. 5
      src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs
  3. 18
      src/AddIns/Misc/Profiler/Controller/Registrar.cs
  4. 1
      src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj
  5. 18
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/General.cs
  6. 6
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml
  7. 24
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml.cs
  8. 44
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/ProfilerOptionsWrapper.cs
  9. 2
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerService.cs

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

@ -493,7 +493,8 @@ namespace ICSharpCode.Profiler.Controller @@ -493,7 +493,8 @@ namespace ICSharpCode.Profiler.Controller
this.logger.Start(nativeToManagedBuffer.CreateReadingStream());
// GC references currentSession
this.dataCollector.Start();
if (this.profilerOptions.EnableDC)
this.dataCollector.Start();
OnSessionStarted(EventArgs.Empty);
return profilee;
@ -563,7 +564,8 @@ namespace ICSharpCode.Profiler.Controller @@ -563,7 +564,8 @@ namespace ICSharpCode.Profiler.Controller
Debug.WriteLine("Joining logger thread...");
this.logger.Join();
Debug.WriteLine("Logger thread joined!");
this.dataCollector.Join();
if (this.profilerOptions.EnableDC)
this.dataCollector.Join();
// Take last shot
if (this.is64Bit)

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

@ -14,7 +14,10 @@ namespace ICSharpCode.Profiler.Controller @@ -14,7 +14,10 @@ namespace ICSharpCode.Profiler.Controller
/// </summary>
public class ProfilerOptions
{
const int SHARED_MEMORY_SIZE = 64 * 1024 * 1024; // 64 mb
/// <summary>
/// Defines a default size of the shared memory.
/// </summary>
public const int SHARED_MEMORY_SIZE = 64 * 1024 * 1024; // 64 mb
bool enableDC;
int sharedMemorySize;

18
src/AddIns/Misc/Profiler/Controller/Registrar.cs

@ -45,12 +45,10 @@ namespace ICSharpCode.Profiler.Controller @@ -45,12 +45,10 @@ namespace ICSharpCode.Profiler.Controller
{
try {
CreateKeys(is64Bit ? ExtendedRegistry.LocalMachine64 : ExtendedRegistry.LocalMachine32, guid, libraryId, classId, path);
}
catch (UnauthorizedAccessException) {
} catch (UnauthorizedAccessException) {
try {
CreateKeys(is64Bit ? ExtendedRegistry.CurrentUser64 : ExtendedRegistry.CurrentUser32, guid, libraryId, classId, path);
}
catch (UnauthorizedAccessException) {
} catch (UnauthorizedAccessException) {
return false;
}
}
@ -83,8 +81,16 @@ namespace ICSharpCode.Profiler.Controller @@ -83,8 +81,16 @@ namespace ICSharpCode.Profiler.Controller
if (guid == null)
throw new ArgumentNullException("guid");
DeleteKey(is64Bit ? ExtendedRegistry.LocalMachine64 : ExtendedRegistry.LocalMachine32, guid);
DeleteKey(is64Bit ? ExtendedRegistry.CurrentUser64 : ExtendedRegistry.CurrentUser32, guid);
try {
DeleteKey(is64Bit ? ExtendedRegistry.LocalMachine64 : ExtendedRegistry.LocalMachine32, guid);
DeleteKey(is64Bit ? ExtendedRegistry.CurrentUser64 : ExtendedRegistry.CurrentUser32, guid);
} catch (UnauthorizedAccessException) {
try {
DeleteKey(is64Bit ? ExtendedRegistry.CurrentUser64 : ExtendedRegistry.CurrentUser32, guid);
} catch (UnauthorizedAccessException) {
return false;
}
}
return true;
}

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

@ -107,7 +107,6 @@ @@ -107,7 +107,6 @@
<DependentUpon>GeneralOptionsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\OptionsPanels\ProfilerOptionsWrapper.cs" />
<Compile Include="Src\ProfilerService.cs" />
<Compile Include="Src\Views\ProfilerView.xaml.cs">
<DependentUpon>ProfilerView.xaml</DependentUpon>

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

@ -6,11 +6,14 @@ @@ -6,11 +6,14 @@
// </file>
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using ICSharpCode.Core;
using ICSharpCode.Profiler.Controller;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using System.Windows.Forms.Integration;
namespace ICSharpCode.Profiler.AddIn.OptionsPanels
{
@ -21,6 +24,8 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels @@ -21,6 +24,8 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels
{
GeneralOptionsPanel panel;
static Properties properties = PropertyService.Get("ProfilerOptions", new Properties());
public General()
{
ElementHost host = new ElementHost();
@ -31,12 +36,23 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels @@ -31,12 +36,23 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels
public override void LoadPanelContents()
{
panel.Load(properties.Get("EnableDC", true),
properties.Get("SharedMemorySize", ProfilerOptions.SHARED_MEMORY_SIZE) / 1024 / 1024);
base.LoadPanelContents();
}
public override bool StorePanelContents()
{
properties.Set("EnableDC", !panel.GetOptionValue<bool>("EnableDC"));
properties.Set("SharedMemorySize", (int)panel.GetOptionValue<double>("SharedMemorySize") * 1024 * 1024);
return base.StorePanelContents();
}
public static ProfilerOptions CreateProfilerOptions()
{
return new ProfilerOptions(properties.Get("EnableDC", true),
properties.Get("SharedMemorySize", ProfilerOptions.SHARED_MEMORY_SIZE));
}
}
}

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

@ -1,11 +1,13 @@ @@ -1,11 +1,13 @@
<UserControl x:Class="ICSharpCode.Profiler.AddIn.OptionsPanels.GeneralOptionsPanel"
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" Width="418" Height="300">
<Grid>
<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 Height="31" Margin="207,26,14,0" Name="slSharedMemorySize" VerticalAlignment="Top" IsDirectionReversed="False" TickPlacement="Both" Minimum="67108864" Maximum="67108864" TickFrequency="1048576" SmallChange="1048576" LargeChange="10485760" IsSnapToTickEnabled="False" />
<Slider Margin="161,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="Right" Margin="0,35,24,5" Width="64" Text="{Binding Value, ElementName=slSharedMemorySize, StringFormat=\{0\} MB}" />
</Grid>
</GroupBox>
</Grid>

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

@ -25,5 +25,29 @@ namespace ICSharpCode.Profiler.AddIn.OptionsPanels @@ -25,5 +25,29 @@ 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;
switch (name) {
case "SharedMemorySize":
o = this.slSharedMemorySize.Value;
break;
case "EnableDC":
o = this.chkEnableDC.IsChecked;
break;
default:
throw new NotSupportedException("value '" + name + "' is not supported!");
}
return (T)o;
}
}
}

44
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/ProfilerOptionsWrapper.cs

@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.Profiler.Controller;
using System;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Profiler.AddIn.OptionsPanels
{
static class ProfilerOptionsWrapper
{
static Properties properties = PropertyService.Get("ProfilerOptions", new Properties());
public static Properties Properties {
get {
return properties;
}
}
public static bool EnableDC {
get { return properties.Get("EnableDC", true); }
set { properties.Set("EnableDC", value); }
}
public static int SharedMemorySize {
get { return properties.Get("SharedMemorySize", 64 * 1024 * 1024); }
set { properties.Set("SharedMemorySize", value); }
}
public static ProfilerOptions CreateProfilerOptions()
{
return new ProfilerOptions(properties.Get("EnableDC", true),
properties.Get("SharedMemorySize", 64 * 1024 * 1024));
}
}
}

2
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerService.cs

@ -39,7 +39,7 @@ namespace ICSharpCode.Profiler.AddIn @@ -39,7 +39,7 @@ namespace ICSharpCode.Profiler.AddIn
}
Profiler.Controller.Profiler profiler = InitProfiler(currentProj.CreateStartInfo(), profilerSessionFilePath);
profiler.ProfilerOptions = ProfilerOptionsWrapper.CreateProfilerOptions();
profiler.ProfilerOptions = General.CreateProfilerOptions();
profiler.Start();
return profiler;

Loading…
Cancel
Save