Browse Source

start working on tasks

pull/15/head
Eusebiu Marcu 15 years ago
parent
commit
50dace3b11
  1. 4
      src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml.cs
  2. 71
      src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStackPad.cs
  3. 1
      src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStacksGraph.cs

4
src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml.cs

@ -33,11 +33,9 @@ namespace Debugger.AddIn.Pads.ParallelPad
if (graph == null) if (graph == null)
this.ParallelStacksLayout.CancelLayout(); this.ParallelStacksLayout.CancelLayout();
else { else
this.ParallelStacksLayout.Relayout();
this.ParallelStacksLayout.Relayout(); this.ParallelStacksLayout.Relayout();
} }
}
public bool IsZoomControlVisible { public bool IsZoomControlVisible {
get { return ZoomControl.Visibility == Visibility.Visible; } get { return ZoomControl.Visibility == Visibility.Visible; }

71
src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStackPad.cs

@ -69,8 +69,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
currentThreadStacks.Clear(); currentThreadStacks.Clear();
if (ParallelStacksView == ParallelStacksView.Threads)
{
using(new PrintTimes("Parallel stack - method view + threads refresh")) { using(new PrintTimes("Parallel stack - method view + threads refresh")) {
try { try {
// create all simple ThreadStacks // create all simple ThreadStacks
@ -90,7 +88,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
} }
} }
} }
using(new PrintTimes("Parallel stack - run algorithm")) {
if (isMethodView) if (isMethodView)
{ {
// build method view for threads // build method view for threads
@ -102,17 +100,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
CreateCommonStacks(); CreateCommonStacks();
} }
} }
else
{
if (isMethodView)
{
// build method view for tasks
}
else
{
// normal
}
}
using(new PrintTimes("Graph refresh")) { using(new PrintTimes("Graph refresh")) {
// paint the ThreadStaks // paint the ThreadStaks
@ -390,7 +377,12 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
ThreadStack common = new ThreadStack(); ThreadStack common = new ThreadStack();
var observ = new ObservableCollection<ExpandoObject>(); var observ = new ObservableCollection<ExpandoObject>();
bool dummy = false; bool dummy = false;
dynamic obj = CreateItem(selectedFrame, selectedFrame.Thread, ref dummy); dynamic obj;
if (parallelStacksView == ParallelStacksView.Threads)
obj = CreateItemForThread(selectedFrame, selectedFrame.Thread, ref dummy);
else
obj = CreateItemForTask(selectedFrame, selectedFrame.Thread, ref dummy);
obj.Image = PresentationResourceService.GetImage("Icons.48x48.CurrentFrame").Source; obj.Image = PresentationResourceService.GetImage("Icons.48x48.CurrentFrame").Source;
observ.Add(obj); observ.Add(obj);
common.ItemCollection = observ; common.ItemCollection = observ;
@ -468,7 +460,12 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
bool lastItemIsExternalMethod = false; bool lastItemIsExternalMethod = false;
var result = new ObservableCollection<ExpandoObject>(); var result = new ObservableCollection<ExpandoObject>();
foreach (StackFrame frame in thread.GetCallstack(100)) { foreach (StackFrame frame in thread.GetCallstack(100)) {
dynamic obj = CreateItem(frame, thread, ref lastItemIsExternalMethod); dynamic obj;
if (parallelStacksView == ParallelStacksView.Threads)
obj = CreateItemForThread(frame, thread, ref lastItemIsExternalMethod);
else
obj = CreateItemForTask(frame, thread, ref lastItemIsExternalMethod);
if (obj != null) if (obj != null)
result.Add(obj); result.Add(obj);
} }
@ -478,7 +475,47 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
return result; return result;
} }
private ExpandoObject CreateItem(StackFrame frame, Thread thread, ref bool lastItemIsExternalMethod) private ExpandoObject CreateItemForThread(StackFrame frame, Thread thread, ref bool lastItemIsExternalMethod)
{
dynamic obj = new ExpandoObject();
string fullName;
if (frame.HasSymbols) {
// Show the method in the list
fullName = frame.GetMethodName();
lastItemIsExternalMethod = false;
obj.FontWeight = FontWeights.Normal;
obj.Foreground = Brushes.Black;
} else {
// Show [External methods] in the list
if (lastItemIsExternalMethod) return null;
fullName = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ExternalMethods").Trim();
obj.FontWeight = FontWeights.Normal;
obj.Foreground = Brushes.Gray;
lastItemIsExternalMethod = true;
}
if (thread.SelectedStackFrame != null &&
thread.ID == debuggedProcess.SelectedThread.ID &&
thread.SelectedStackFrame.IP == frame.IP &&
thread.SelectedStackFrame.GetMethodName() == frame.GetMethodName()) {
obj.Image = PresentationResourceService.GetImage("Bookmarks.CurrentLine").Source;
obj.IsRunningStackFrame = true;
}
else {
if (selectedFrame != null && frame.Thread.ID == selectedFrame.Thread.ID &&
frame.GetMethodName() == selectedFrame.GetMethodName())
obj.Image = PresentationResourceService.GetImage("Icons.48x48.CurrentFrame").Source;
else
obj.Image = null;
obj.IsRunningStackFrame = false;
}
obj.MethodName = fullName;
return obj;
}
private ExpandoObject CreateItemForTask(StackFrame frame, Thread thread, ref bool lastItemIsExternalMethod)
{ {
dynamic obj = new ExpandoObject(); dynamic obj = new ExpandoObject();
string fullName; string fullName;

1
src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStacksGraph.cs

@ -25,6 +25,7 @@ namespace Debugger.AddIn.Pads.ParallelPad
{ {
public ParallelStacksGraphLayout() public ParallelStacksGraphLayout()
{ {
// TODO : Replace the current tree layout with EfficientSugiyama layout when Direction is available for this type of layout
var par = new SimpleTreeLayoutParameters(); var par = new SimpleTreeLayoutParameters();
par.LayerGap = 30; par.LayerGap = 30;
par.VertexGap = 50; par.VertexGap = 50;

Loading…
Cancel
Save