diff --git a/src/AddIns/Misc/Profiler/Controller/Profiler.cs b/src/AddIns/Misc/Profiler/Controller/Profiler.cs
index 61e3772d2b..3835a8f571 100644
--- a/src/AddIns/Misc/Profiler/Controller/Profiler.cs
+++ b/src/AddIns/Misc/Profiler/Controller/Profiler.cs
@@ -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
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)
diff --git a/src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs b/src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs
index 2202741b79..5fd0f153d7 100644
--- a/src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs
+++ b/src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs
@@ -14,7 +14,10 @@ namespace ICSharpCode.Profiler.Controller
///
public class ProfilerOptions
{
- const int SHARED_MEMORY_SIZE = 64 * 1024 * 1024; // 64 mb
+ ///
+ /// Defines a default size of the shared memory.
+ ///
+ public const int SHARED_MEMORY_SIZE = 64 * 1024 * 1024; // 64 mb
bool enableDC;
int sharedMemorySize;
diff --git a/src/AddIns/Misc/Profiler/Controller/Registrar.cs b/src/AddIns/Misc/Profiler/Controller/Registrar.cs
index 4176a19a79..b7429f808a 100644
--- a/src/AddIns/Misc/Profiler/Controller/Registrar.cs
+++ b/src/AddIns/Misc/Profiler/Controller/Registrar.cs
@@ -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
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;
}
diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj b/src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj
index 67118d597c..d5eca8b314 100644
--- a/src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj
+++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj
@@ -107,7 +107,6 @@
GeneralOptionsPanel.xaml
Code
-
ProfilerView.xaml
diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/General.cs b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/General.cs
index fff9a2fba3..93511116be 100644
--- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/General.cs
+++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/General.cs
@@ -6,11 +6,14 @@
//
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
{
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
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("EnableDC"));
+ properties.Set("SharedMemorySize", (int)panel.GetOptionValue("SharedMemorySize") * 1024 * 1024);
+
return base.StorePanelContents();
}
+
+ public static ProfilerOptions CreateProfilerOptions()
+ {
+ return new ProfilerOptions(properties.Get("EnableDC", true),
+ properties.Get("SharedMemorySize", ProfilerOptions.SHARED_MEMORY_SIZE));
+ }
}
}
diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml
index c80e98b051..96a9690ac5 100644
--- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml
+++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml
@@ -1,11 +1,13 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="418" Height="300">
Only collect data at the end of the session.
-
+
+
+
diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml.cs b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml.cs
index 8d1050fe5c..5e14a907a9 100644
--- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml.cs
+++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/GeneralOptionsPanel.xaml.cs
@@ -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(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;
+ }
}
}
\ No newline at end of file
diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/ProfilerOptionsWrapper.cs b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/ProfilerOptionsWrapper.cs
deleted file mode 100644
index 29f2b86240..0000000000
--- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/OptionsPanels/ProfilerOptionsWrapper.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-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));
- }
- }
-}
diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerService.cs b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerService.cs
index 21f8fcd80a..40b704a71f 100644
--- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerService.cs
+++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerService.cs
@@ -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;