Author: bmotmans
Date: 2007-12-20 07:28:19 -0500 (Thu, 20 Dec 2007)
New Revision: 91696
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapBuddy/ChangeLog
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapBuddy/HeapBuddyProfiler.cs
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapShot/ChangeLog
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapShot/HeapShotProfiler.cs
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/AbstractProfiler.cs
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/ChangeLog
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/IProfiler.cs
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/ProfilingService.cs
Log:
* MonoDevelop.Profiling/IProfiler.cs,
MonoDevelop.Profiling/AbstractProfiler.cs,
MonoDevelop.Profiling/ProfilingService.cs,
MonoDevelop.Profiling.HeapShot/HeapShotProfiler.cs: handle snapshot
failures
* MonoDevelop.Profiling.HeapBuddy/HeapBuddyProfiler.cs: show a warning
message when trying to kill the profiler + handle snapshot failures
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/AbstractProfiler.cs
===================================================================
---
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/AbstractProfiler.cs
2007-12-20 11:59:41 UTC (rev 91695)
+++
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/AbstractProfiler.cs
2007-12-20 12:28:19 UTC (rev 91696)
@@ -45,6 +45,7 @@
protected object sync = new object ();
public event ProfilingSnapshotEventHandler SnapshotTaken;
+ public event EventHandler SnapshotFailed;
public event ProfilerStateEventHandler StateChanged;
public event EventHandler Started;
@@ -108,6 +109,12 @@
SnapshotTaken (this, args);
}
+ protected virtual void OnSnapshotFailed (EventArgs args)
+ {
+ if (SnapshotFailed != null)
+ SnapshotFailed (this, args);
+ }
+
protected virtual void OnStateChanged (ProfilerStateEventArgs
args)
{
if (StateChanged != null)
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/ChangeLog
===================================================================
---
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/ChangeLog
2007-12-20 11:59:41 UTC (rev 91695)
+++
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/ChangeLog
2007-12-20 12:28:19 UTC (rev 91696)
@@ -1,5 +1,10 @@
2007-12-20 Ben Motmans <[EMAIL PROTECTED]>
+ * IProfiler.cs, AbstractProfiler.cs, ProfilingService.cs: handle
snapshot
+ failures
+
+2007-12-20 Ben Motmans <[EMAIL PROTECTED]>
+
* MonoDevelop.Profiling.addin.xml: removed the 'defaultVisible'
attribute
from all ContextPad nodes since it no longer exists
* ProfilingOperations.cs: show the profiling pad when switching to the
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/IProfiler.cs
===================================================================
---
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/IProfiler.cs
2007-12-20 11:59:41 UTC (rev 91695)
+++
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/IProfiler.cs
2007-12-20 12:28:19 UTC (rev 91696)
@@ -45,7 +45,8 @@
IExecutionHandlerFactory GetProcessExecutionHandlerFactory
(Process process);
event ProfilingSnapshotEventHandler SnapshotTaken;
- event ProfilerStateEventHandler StateChanged;
+ event EventHandler SnapshotFailed;
+ event ProfilerStateEventHandler StateChanged;
event EventHandler Started;
event EventHandler Stopped;
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/ProfilingService.cs
===================================================================
---
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/ProfilingService.cs
2007-12-20 11:59:41 UTC (rev 91695)
+++
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling/ProfilingService.cs
2007-12-20 12:28:19 UTC (rev 91696)
@@ -43,12 +43,14 @@
{
public static event ProfilerEventHandler ActiveProfilerChanged;
public static event ProfilingSnapshotEventHandler SnapshotTaken;
+ public static event EventHandler SnapshotFailed;
private static IProfiler activeProfiler;
private static Dictionary<string, IProfiler> profilers;
private static ProfilingSnapshotCollection profilingSnapshots;
private static ProfilingSnapshotEventHandler snapshotHandler;
+ private static EventHandler snapshotFailedHandler;
private static ProfilerStateEventHandler stateHandler;
static ProfilingService ()
@@ -60,8 +62,9 @@
profilers.Add (prof.Identifier, prof);
}
- snapshotHandler = new ProfilingSnapshotEventHandler
(OnSnapshotTaken);
- stateHandler = new ProfilerStateEventHandler
(OnStateChanged);
+ snapshotHandler = new ProfilingSnapshotEventHandler
(HandleSnapshotTaken);
+ stateHandler = new ProfilerStateEventHandler
(HandleStateChanged);
+ snapshotFailedHandler = new EventHandler
(HandleSnapshotFailed);
string configFile = Path.Combine
(PropertyService.ConfigPath, "MonoDevelop.Profiling.xml");
profilingSnapshots = new ProfilingSnapshotCollection
(configFile);
@@ -80,12 +83,14 @@
if (activeProfiler.State !=
ProfilerState.Inactive)
activeProfiler.Stop
();
activeProfiler.SnapshotTaken -=
snapshotHandler;
- activeProfiler.StateChanged -=
stateHandler;
+ activeProfiler.SnapshotFailed
-= snapshotFailedHandler;
+ activeProfiler.StateChanged -=
stateHandler;
}
activeProfiler = value;
if (activeProfiler != null) {
activeProfiler.SnapshotTaken +=
snapshotHandler;
+ activeProfiler.SnapshotFailed
+= snapshotFailedHandler;
activeProfiler.StateChanged +=
stateHandler;
} else {
ProfilingOperations.RestoreWorkbenchContext ();
@@ -184,7 +189,7 @@
}
}
- private static void OnSnapshotTaken (object sender,
ProfilingSnapshotEventArgs args)
+ private static void HandleSnapshotTaken (object sender,
ProfilingSnapshotEventArgs args)
{
profilingSnapshots.Add (args.Snapshot);
@@ -192,8 +197,16 @@
SnapshotTaken (sender, args);
}
- private static void OnStateChanged (object sender,
ProfilerStateEventArgs args)
+ private static void HandleSnapshotFailed (object sender,
EventArgs args)
{
+ Services.MessageService.ShowError
(GettextCatalog.GetString ("Unable to take a profiling snapshot."));
+
+ if (SnapshotFailed != null)
+ SnapshotFailed (sender, args);
+ }
+
+ private static void HandleStateChanged (object sender,
ProfilerStateEventArgs args)
+ {
if (args.State == ProfilerState.Inactive)
ActiveProfiler = null;
}
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapBuddy/ChangeLog
===================================================================
---
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapBuddy/ChangeLog
2007-12-20 11:59:41 UTC (rev 91695)
+++
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapBuddy/ChangeLog
2007-12-20 12:28:19 UTC (rev 91696)
@@ -1,5 +1,10 @@
2007-12-20 Ben Motmans <[EMAIL PROTECTED]>
+ * HeapBuddyProfiler.cs: show a warning message when trying to kill the
+ profiler + handle snapshot failures
+
+2007-12-20 Ben Motmans <[EMAIL PROTECTED]>
+
* Makefile.am: automatic MD changes
2007-12-19 Ben Motmans <[EMAIL PROTECTED]>
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapBuddy/HeapBuddyProfiler.cs
===================================================================
---
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapBuddy/HeapBuddyProfiler.cs
2007-12-20 11:59:41 UTC (rev 91695)
+++
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapBuddy/HeapBuddyProfiler.cs
2007-12-20 12:28:19 UTC (rev 91696)
@@ -65,15 +65,18 @@
public override void TakeSnapshot ()
{
- //TODO: show a message dialog:
- //"The process or application should exit cleanly"
- // "cancel and close the application manually" - "i
don't care, just kill it"
+ bool terminate = Services.MessageService.AskQuestion (
+ GettextCatalog.GetString ("Heap-Buddy requires
the application to terminate cleanly.\nAre you sure you want to terminate the
application (this might result in the loss of some profiling data)?")
+ , GettextCatalog.GetString ("Take snapshot")
+ );
- lock (sync) {
- State = ProfilerState.TakingSnapshot;
-
- System.Diagnostics.Process.Start ("kill",
"-PROF " + Context.AsyncOperation.ProcessId);
- ThreadPool.QueueUserWorkItem (new WaitCallback
(AsyncTakeSnapshot));
+ if (terminate) {
+ lock (sync) {
+ State = ProfilerState.TakingSnapshot;
+
+ System.Diagnostics.Process.Start
("kill", "-PROF " + Context.AsyncOperation.ProcessId);
+ ThreadPool.QueueUserWorkItem (new
WaitCallback (AsyncTakeSnapshot));
+ }
}
}
@@ -87,8 +90,10 @@
bool success = false;
while (!success) {
- if (--attempts == 0)
- return; //TODO: SnapshotError event?
+ if (--attempts == 0) {
+ OnSnapshotFailed (EventArgs.Empty);
+ return;
+ }
Thread.Sleep (500);
if (!File.Exists (dumpFile))
@@ -132,10 +137,10 @@
public override void Stop ()
{
lock (sync) {
- if (State == ProfilerState.Profiling) {
+ if (State != ProfilerState.Inactive) {
Context.AsyncOperation.Cancel ();
- }
- State = ProfilerState.Inactive;
+ State = ProfilerState.Inactive;
+ }
}
}
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapShot/ChangeLog
===================================================================
---
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapShot/ChangeLog
2007-12-20 11:59:41 UTC (rev 91695)
+++
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapShot/ChangeLog
2007-12-20 12:28:19 UTC (rev 91696)
@@ -1,5 +1,9 @@
2007-12-20 Ben Motmans <[EMAIL PROTECTED]>
+ * HeapShotProfiler.cs: handle snapshot failures
+
+2007-12-20 Ben Motmans <[EMAIL PROTECTED]>
+
* HeapShotProfiler.cs: send the -PROF signal instead of -9
* Makefile.am: automatic MD changes
Modified:
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapShot/HeapShotProfiler.cs
===================================================================
---
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapShot/HeapShotProfiler.cs
2007-12-20 11:59:41 UTC (rev 91695)
+++
trunk/monodevelop/extras/MonoDevelop.Profiling/MonoDevelop.Profiling.HeapShot/HeapShotProfiler.cs
2007-12-20 12:28:19 UTC (rev 91696)
@@ -84,8 +84,10 @@
bool success = false;
while (!success) {
- if (--attempts == 0)
- return; //TODO: SnapshotError event?
+ if (--attempts == 0) {
+ OnSnapshotFailed (EventArgs.Empty);
+ return;
+ }
Thread.Sleep (500);
if (!File.Exists (dumpFile))
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches