1 package org.catacomb.dataview;
2
3 import org.catacomb.graph.gui.DataDisplay;
4 import org.catacomb.report.E;
5
6
7 public class Plotter {
8
9
10
11 public static void main(String[] argv) {
12
13 DataDisplay.setBatch();
14
15
16
17
18
19 showThreads();
20
21 }
22
23
24
25
26 public static void showThreads() {
27
28
29 ThreadGroup root = Thread.currentThread().getThreadGroup();
30 while (root.getParent() != null) {
31 root = root.getParent();
32 }
33
34
35 visit(root, 0);
36
37 }
38
39
40 public static void visit(ThreadGroup group, int level) {
41
42 int numThreads = group.activeCount();
43 Thread[] threads = new Thread[numThreads*2];
44 numThreads = group.enumerate(threads, false);
45
46
47 for (int i=0; i<numThreads; i++) {
48
49 Thread thread = threads[i];
50 E.info("Thread: " + thread.isDaemon() + " " + thread);
51 }
52
53
54 int numGroups = group.activeGroupCount();
55 ThreadGroup[] groups = new ThreadGroup[numGroups*2];
56 numGroups = group.enumerate(groups, false);
57
58
59 for (int i=0; i<numGroups; i++) {
60 visit(groups[i], level+1);
61 }
62 }
63
64 }