sun.jvm.hotspot.runtime.JavaThread Java Examples

The following examples show how to use sun.jvm.hotspot.runtime.JavaThread. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        Threads threads = VM.getVM().getThreads();
        boolean all = name.equals("-a");
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                out.println("Thread " + bos.toString() + " Address " + thread.getAddress());
                thread.printInfoOn(out);
                out.println(" ");
                if (!all) return;
            }
        }
        out.println("Couldn't find thread " + name);
    }
}
 
Example #2
Source File: ThreadGroupReferenceImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public List threads() {
    // Each element of this array is the Oop for a thread;
    // NOTE it is not the JavaThread that we need to create
    // a ThreadReferenceImpl.
    Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());

    ArrayList myList = new ArrayList(myThreads.length);
    for (int ii = 0; ii < myThreads.length; ii++) {
        JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
        if (jt != null) {
            ThreadReferenceImpl xx = (ThreadReferenceImpl)vm.threadMirror(jt);
            myList.add(xx);
        }
    }
    return myList;
}
 
Example #3
Source File: ThreadGroupReferenceImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public List threads() {
    // Each element of this array is the Oop for a thread;
    // NOTE it is not the JavaThread that we need to create
    // a ThreadReferenceImpl.
    Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());

    ArrayList myList = new ArrayList(myThreads.length);
    for (int ii = 0; ii < myThreads.length; ii++) {
        JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
        if (jt != null) {
            ThreadReferenceImpl xx = (ThreadReferenceImpl)vm.threadMirror(jt);
            myList.add(xx);
        }
    }
    return myList;
}
 
Example #4
Source File: BsdDebuggerLocal.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** this functions used for core file reading and called from native attach0,
    it returns an array of long integers as
    [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for
    all java threads recorded in Threads. Also adds the ThreadProxy to threadList */
public long[] getJavaThreadsInfo() {
    requireAttach();
    Threads threads = VM.getVM().getThreads();
    int len = threads.getNumberOfThreads();
    long[] result = new long[len * 3];    // triple
    JavaThread t = threads.first();
    long beg, end;
    int i = 0;
    while (t != null) {
        end = t.getStackBaseValue();
        beg = end - t.getStackSize();
        BsdThread bsdt = (BsdThread)t.getThreadProxy();
        long uid = bsdt.getUniqueThreadId();
        if (threadList != null) threadList.add(bsdt);
        result[i] = uid;
        result[i + 1] = beg;
        result[i + 2] = end;
        t = t.next();
        i += 3;
    }
    return result;
}
 
Example #5
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        ArrayList nmethods = new ArrayList();
        Threads threads = VM.getVM().getThreads();
        HTMLGenerator gen = new HTMLGenerator(false);
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            try {
                for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
                    if (vf instanceof CompiledVFrame) {
                        NMethod c = ((CompiledVFrame)vf).getCode();
                        if (!nmethods.contains(c)) {
                            nmethods.add(c);
                            out.println(gen.genHTML(c));
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example #6
Source File: CommandProcessor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                if (thread instanceof CompilerThread) {
                    CompilerThread ct = (CompilerThread)thread;
                    ciEnv env = ct.env();
                    if (env != null) {
                        Compile c = env.compilerData();
                        InlineTree ilt = c.ilt();
                        if (ilt != null) {
                            ilt.print(out);
                        }
                    }
                }
            }
        }
    }
}
 
Example #7
Source File: CommandProcessor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
              if (thread instanceof CompilerThread) {
                CompilerThread ct = (CompilerThread)thread;
                out.println(ct);
                ciEnv env = ct.env();
                if (env != null) {
                  Compile c = env.compilerData();
                  c.root().dump(9999, out);
                } else {
                  out.println("  not compiling");
                }
              }
            }
        }
    }
}
 
Example #8
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
              if (thread instanceof CompilerThread) {
                CompilerThread ct = (CompilerThread)thread;
                out.println(ct);
                ciEnv env = ct.env();
                if (env != null) {
                  Compile c = env.compilerData();
                  c.root().dump(9999, out);
                } else {
                  out.println("  not compiling");
                }
              }
            }
        }
    }
}
 
Example #9
Source File: CommandProcessor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        ArrayList nmethods = new ArrayList();
        Threads threads = VM.getVM().getThreads();
        HTMLGenerator gen = new HTMLGenerator(false);
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            try {
                for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
                    if (vf instanceof CompiledVFrame) {
                        NMethod c = ((CompiledVFrame)vf).getCode();
                        if (!nmethods.contains(c)) {
                            nmethods.add(c);
                            out.println(gen.genHTML(c));
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example #10
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                if (thread instanceof CompilerThread) {
                    CompilerThread ct = (CompilerThread)thread;
                    ciEnv env = ct.env();
                    if (env != null) {
                        Compile c = env.compilerData();
                        InlineTree ilt = c.ilt();
                        if (ilt != null) {
                            ilt.print(out);
                        }
                    }
                }
            }
        }
    }
}
 
Example #11
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
              if (thread instanceof CompilerThread) {
                CompilerThread ct = (CompilerThread)thread;
                out.println(ct);
                ciEnv env = ct.env();
                if (env != null) {
                  Compile c = env.compilerData();
                  c.cfg().dump(out);
                }
              }
            }
        }
    }
}
 
Example #12
Source File: ThreadGroupReferenceImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public List threads() {
    // Each element of this array is the Oop for a thread;
    // NOTE it is not the JavaThread that we need to create
    // a ThreadReferenceImpl.
    Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());

    ArrayList myList = new ArrayList(myThreads.length);
    for (int ii = 0; ii < myThreads.length; ii++) {
        JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
        if (jt != null) {
            ThreadReferenceImpl xx = (ThreadReferenceImpl)vm.threadMirror(jt);
            myList.add(xx);
        }
    }
    return myList;
}
 
Example #13
Source File: BsdDebuggerLocal.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/** this functions used for core file reading and called from native attach0,
    it returns an array of long integers as
    [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for
    all java threads recorded in Threads. Also adds the ThreadProxy to threadList */
public long[] getJavaThreadsInfo() {
    requireAttach();
    Threads threads = VM.getVM().getThreads();
    int len = threads.getNumberOfThreads();
    long[] result = new long[len * 3];    // triple
    JavaThread t = threads.first();
    long beg, end;
    int i = 0;
    while (t != null) {
        end = t.getStackBaseValue();
        beg = end - t.getStackSize();
        BsdThread bsdt = (BsdThread)t.getThreadProxy();
        long uid = bsdt.getUniqueThreadId();
        if (threadList != null) threadList.add(bsdt);
        result[i] = uid;
        result[i + 1] = beg;
        result[i + 2] = end;
        t = t.next();
        i += 3;
    }
    return result;
}
 
Example #14
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        ArrayList nmethods = new ArrayList();
        Threads threads = VM.getVM().getThreads();
        HTMLGenerator gen = new HTMLGenerator(false);
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            try {
                for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
                    if (vf instanceof CompiledVFrame) {
                        NMethod c = ((CompiledVFrame)vf).getCode();
                        if (!nmethods.contains(c)) {
                            nmethods.add(c);
                            out.println(gen.genHTML(c));
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example #15
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                if (thread instanceof CompilerThread) {
                    CompilerThread ct = (CompilerThread)thread;
                    ciEnv env = ct.env();
                    if (env != null) {
                        Compile c = env.compilerData();
                        InlineTree ilt = c.ilt();
                        if (ilt != null) {
                            ilt.print(out);
                        }
                    }
                }
            }
        }
    }
}
 
Example #16
Source File: BsdDebuggerLocal.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** this functions used for core file reading and called from native attach0,
    it returns an array of long integers as
    [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for
    all java threads recorded in Threads. Also adds the ThreadProxy to threadList */
public long[] getJavaThreadsInfo() {
    requireAttach();
    Threads threads = VM.getVM().getThreads();
    int len = threads.getNumberOfThreads();
    long[] result = new long[len * 3];    // triple
    JavaThread t = threads.first();
    long beg, end;
    int i = 0;
    while (t != null) {
        end = t.getStackBaseValue();
        beg = end - t.getStackSize();
        BsdThread bsdt = (BsdThread)t.getThreadProxy();
        long uid = bsdt.getUniqueThreadId();
        if (threadList != null) threadList.add(bsdt);
        result[i] = uid;
        result[i + 1] = beg;
        result[i + 2] = end;
        t = t.next();
        i += 3;
    }
    return result;
}
 
Example #17
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        Threads threads = VM.getVM().getThreads();
        boolean all = name.equals("-a");
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                out.println("Thread " + bos.toString() + " Address " + thread.getAddress());
                if (!all) return;
            }
        }
        out.println("Couldn't find thread " + name);
    }
}
 
Example #18
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        ArrayList nmethods = new ArrayList();
        Threads threads = VM.getVM().getThreads();
        HTMLGenerator gen = new HTMLGenerator(false);
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            try {
                for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
                    if (vf instanceof CompiledVFrame) {
                        NMethod c = ((CompiledVFrame)vf).getCode();
                        if (!nmethods.contains(c)) {
                            nmethods.add(c);
                            out.println(gen.genHTML(c));
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example #19
Source File: BsdDebuggerLocal.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** this functions used for core file reading and called from native attach0,
    it returns an array of long integers as
    [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for
    all java threads recorded in Threads. Also adds the ThreadProxy to threadList */
public long[] getJavaThreadsInfo() {
    requireAttach();
    Threads threads = VM.getVM().getThreads();
    int len = threads.getNumberOfThreads();
    long[] result = new long[len * 3];    // triple
    JavaThread t = threads.first();
    long beg, end;
    int i = 0;
    while (t != null) {
        end = t.getStackBaseValue();
        beg = end - t.getStackSize();
        BsdThread bsdt = (BsdThread)t.getThreadProxy();
        long uid = bsdt.getUniqueThreadId();
        if (threadList != null) threadList.add(bsdt);
        result[i] = uid;
        result[i + 1] = beg;
        result[i + 2] = end;
        t = t.next();
        i += 3;
    }
    return result;
}
 
Example #20
Source File: CommandProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        ArrayList nmethods = new ArrayList();
        Threads threads = VM.getVM().getThreads();
        HTMLGenerator gen = new HTMLGenerator(false);
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            try {
                for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
                    if (vf instanceof CompiledVFrame) {
                        NMethod c = ((CompiledVFrame)vf).getCode();
                        if (!nmethods.contains(c)) {
                            nmethods.add(c);
                            out.println(gen.genHTML(c));
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example #21
Source File: ThreadGroupReferenceImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public List threads() {
    // Each element of this array is the Oop for a thread;
    // NOTE it is not the JavaThread that we need to create
    // a ThreadReferenceImpl.
    Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());

    ArrayList myList = new ArrayList(myThreads.length);
    for (int ii = 0; ii < myThreads.length; ii++) {
        JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
        if (jt != null) {
            ThreadReferenceImpl xx = (ThreadReferenceImpl)vm.threadMirror(jt);
            myList.add(xx);
        }
    }
    return myList;
}
 
Example #22
Source File: BsdDebuggerLocal.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** this functions used for core file reading and called from native attach0,
    it returns an array of long integers as
    [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for
    all java threads recorded in Threads. Also adds the ThreadProxy to threadList */
public long[] getJavaThreadsInfo() {
    requireAttach();
    Threads threads = VM.getVM().getThreads();
    int len = threads.getNumberOfThreads();
    long[] result = new long[len * 3];    // triple
    JavaThread t = threads.first();
    long beg, end;
    int i = 0;
    while (t != null) {
        end = t.getStackBaseValue();
        beg = end - t.getStackSize();
        BsdThread bsdt = (BsdThread)t.getThreadProxy();
        long uid = bsdt.getUniqueThreadId();
        if (threadList != null) threadList.add(bsdt);
        result[i] = uid;
        result[i + 1] = beg;
        result[i + 2] = end;
        t = t.next();
        i += 3;
    }
    return result;
}
 
Example #23
Source File: CommandProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        Threads threads = VM.getVM().getThreads();
        boolean all = name.equals("-a");
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                out.println("Thread " + bos.toString() + " Address " + thread.getAddress());
                thread.printInfoOn(out);
                out.println(" ");
                if (!all) return;
            }
        }
        out.println("Couldn't find thread " + name);
    }
}
 
Example #24
Source File: ThreadGroupReferenceImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public List threads() {
    // Each element of this array is the Oop for a thread;
    // NOTE it is not the JavaThread that we need to create
    // a ThreadReferenceImpl.
    Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());

    ArrayList myList = new ArrayList(myThreads.length);
    for (int ii = 0; ii < myThreads.length; ii++) {
        JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
        if (jt != null) {
            ThreadReferenceImpl xx = (ThreadReferenceImpl)vm.threadMirror(jt);
            myList.add(xx);
        }
    }
    return myList;
}
 
Example #25
Source File: CommandProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                if (thread instanceof CompilerThread) {
                    CompilerThread ct = (CompilerThread)thread;
                    ciEnv env = ct.env();
                    if (env != null) {
                        Compile c = env.compilerData();
                        InlineTree ilt = c.ilt();
                        if (ilt != null) {
                            ilt.print(out);
                        }
                    }
                }
            }
        }
    }
}
 
Example #26
Source File: CommandProcessor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        Threads threads = VM.getVM().getThreads();
        boolean all = name.equals("-a");
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                out.println("Thread " + bos.toString() + " Address " + thread.getAddress());
                thread.printInfoOn(out);
                out.println(" ");
                if (!all) return;
            }
        }
        out.println("Couldn't find thread " + name);
    }
}
 
Example #27
Source File: CommandProcessor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        ArrayList nmethods = new ArrayList();
        Threads threads = VM.getVM().getThreads();
        HTMLGenerator gen = new HTMLGenerator(false);
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            try {
                for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
                    if (vf instanceof CompiledVFrame) {
                        NMethod c = ((CompiledVFrame)vf).getCode();
                        if (!nmethods.contains(c)) {
                            nmethods.add(c);
                            out.println(gen.genHTML(c));
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example #28
Source File: CommandProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
              if (thread instanceof CompilerThread) {
                CompilerThread ct = (CompilerThread)thread;
                out.println(ct);
                ciEnv env = ct.env();
                if (env != null) {
                  Compile c = env.compilerData();
                  c.root().dump(9999, out);
                } else {
                  out.println("  not compiling");
                }
              }
            }
        }
    }
}
 
Example #29
Source File: ThreadGroupReferenceImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public List threads() {
    // Each element of this array is the Oop for a thread;
    // NOTE it is not the JavaThread that we need to create
    // a ThreadReferenceImpl.
    Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());

    ArrayList myList = new ArrayList(myThreads.length);
    for (int ii = 0; ii < myThreads.length; ii++) {
        JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
        if (jt != null) {
            ThreadReferenceImpl xx = (ThreadReferenceImpl)vm.threadMirror(jt);
            myList.add(xx);
        }
    }
    return myList;
}
 
Example #30
Source File: BsdDebuggerLocal.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** this functions used for core file reading and called from native attach0,
    it returns an array of long integers as
    [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for
    all java threads recorded in Threads. Also adds the ThreadProxy to threadList */
public long[] getJavaThreadsInfo() {
    requireAttach();
    Threads threads = VM.getVM().getThreads();
    int len = threads.getNumberOfThreads();
    long[] result = new long[len * 3];    // triple
    JavaThread t = threads.first();
    long beg, end;
    int i = 0;
    while (t != null) {
        end = t.getStackBaseValue();
        beg = end - t.getStackSize();
        BsdThread bsdt = (BsdThread)t.getThreadProxy();
        long uid = bsdt.getUniqueThreadId();
        if (threadList != null) threadList.add(bsdt);
        result[i] = uid;
        result[i + 1] = beg;
        result[i + 2] = end;
        t = t.next();
        i += 3;
    }
    return result;
}