void AddChildren(ThreadStack parent) { if (parent.ThreadStackChildren == null || parent.ThreadStackChildren.Count == 0) { return; } foreach (var ts in parent.ThreadStackChildren) { if (ts == null) { continue; } graph.AddVertex(ts); graph.AddEdge(new ParallelStacksEdge(parent, ts)); if (ts.ThreadStackChildren == null || ts.ThreadStackChildren.Count == 0) { continue; } AddChildren(ts); } }
protected override void RefreshPad() { if (debuggedProcess == null || debuggedProcess.IsRunning) { return; } LoggingService.InfoFormatted("Start refresh: {0}" + Environment.NewLine, parallelStacksView); currentThreadStacks.Clear(); using (new PrintTimes("Create stacks")) { try { // create all simple ThreadStacks foreach (Thread thread in debuggedProcess.Threads) { var t = thread; debuggedProcess.EnqueueWork(Dispatcher.CurrentDispatcher, () => CreateThreadStack(t)); } } catch (AbortedBecauseDebuggeeResumedException) { } catch (System.Exception) { if (debuggedProcess == null || debuggedProcess.HasExited) { // Process unexpectedly exited } else { throw; } } } using (new PrintTimes("Run algorithm")) { if (isMethodView) { // build method view for threads CreateMethodViewStacks(); } else { // normal view CreateCommonStacks(); } } using (new PrintTimes("Graph refresh")) { // paint the ThreadStaks graph = new ParallelStacksGraph(); foreach (var stack in this.currentThreadStacks.FindAll(ts => ts.ThreadStackParents == null)) { graph.AddVertex(stack); // add the children AddChildren(stack); } if (graph.VertexCount > 0) { surface.SetGraph(graph); } } }