[Swift-commit] r5842 - trunk/src/org/griphyn/vdl/karajan
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Mon Jul 16 23:48:30 CDT 2012
Author: hategan
Date: 2012-07-16 23:48:30 -0500 (Mon, 16 Jul 2012)
New Revision: 5842
Modified:
trunk/src/org/griphyn/vdl/karajan/Monitor.java
Log:
better path printing and more modularity
Modified: trunk/src/org/griphyn/vdl/karajan/Monitor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/Monitor.java 2012-07-17 04:47:33 UTC (rev 5841)
+++ trunk/src/org/griphyn/vdl/karajan/Monitor.java 2012-07-17 04:48:30 UTC (rev 5842)
@@ -67,6 +67,7 @@
import org.griphyn.vdl.mapping.ArrayDataNode;
import org.griphyn.vdl.mapping.DSHandle;
import org.griphyn.vdl.mapping.DependentException;
+import org.griphyn.vdl.mapping.Path;
public class Monitor implements ActionListener, MouseListener {
public static final int VARS = 0;
@@ -262,25 +263,31 @@
pw.println("\nWaiting threads:");
Map<VariableStack, DSHandle> c = WaitingThreadsMonitor.getAllThreads();
for (Map.Entry<VariableStack, DSHandle> e : c.entrySet()) {
- try {
- pw.println("Thread: " + String.valueOf(ThreadingContext.get(e.getKey())) + ", waiting on "
- + varWithLine(e.getValue()));
-
- for (String t : getSwiftTrace(e.getKey())) {
- pw.println("\t" + t);
- }
- }
- catch (VariableNotFoundException e1) {
- pw.println("unknown thread");
- }
+ dumpThread(pw, e.getKey(), e.getValue());
+ pw.println();
}
pw.println("----");
}
- public static String varWithLine(DSHandle value) {
+ public static void dumpThread(PrintStream pw, VariableStack stack, DSHandle handle) {
+ try {
+ pw.println("Thread: " + String.valueOf(ThreadingContext.get(stack))
+ + (handle == null ? "" : ", waiting on " + varWithLine(handle)));
+
+ for (String t : getSwiftTrace(stack)) {
+ pw.println("\t" + t);
+ }
+ }
+ catch (VariableNotFoundException e1) {
+ pw.println("unknown thread");
+ }
+ }
+
+ public static String varWithLine(DSHandle value) {
String line = value.getRoot().getParam("line");
+ Path path = value.getPathFromRoot();
return value.getRoot().getParam("dbgname") +
- (value == value.getRoot() ? "" : value.getPathFromRoot()) +
+ (value == value.getRoot() ? "" : (path.isArrayIndex(0) ? path : "." + path)) +
(line == null ? "" : " (declared on line " + line + ")");
}
More information about the Swift-commit
mailing list