< prev index next >

test/hotspot/jtreg/runtime/Thread/TestThreadDumpSMRInfo.java

Print this page
rev 48227 : 8193135: get rid of redundant _smr_ prefix/infix in ThreadSMRSupport stuff
Reviewed-by:


  28  *
  29  * @library /test/lib
  30  * @modules java.base/jdk.internal.misc
  31  *          java.management
  32  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+EnableThreadSMRStatistics TestThreadDumpSMRInfo
  33  */
  34 
  35 import jdk.test.lib.process.OutputAnalyzer;
  36 import jdk.test.lib.JDKToolFinder;
  37 
  38 public class TestThreadDumpSMRInfo {
  39     // jstack tends to be closely bound to the VM that we are running
  40     // so use getTestJDKTool() instead of getCompileJDKTool() or even
  41     // getJDKTool() which can fall back to "compile.jdk".
  42     final static String JSTACK = JDKToolFinder.getTestJDKTool("jstack");
  43     final static String PID = "" + ProcessHandle.current().pid();
  44 
  45     // Here's a sample "Threads class SMR info" section:
  46     //
  47     // Threads class SMR info:
  48     // _smr_java_thread_list=0x0000000000ce8da0, length=23, elements={
  49     // 0x000000000043a800, 0x0000000000aee800, 0x0000000000b06800, 0x0000000000b26000,
  50     // 0x0000000000b28800, 0x0000000000b2b000, 0x0000000000b2e000, 0x0000000000b30000,
  51     // 0x0000000000b32800, 0x0000000000b35000, 0x0000000000b3f000, 0x0000000000b41800,
  52     // 0x0000000000b44000, 0x0000000000b46800, 0x0000000000b48800, 0x0000000000b53000,
  53     // 0x0000000000b55800, 0x0000000000b57800, 0x0000000000b5a000, 0x0000000000b5c800,
  54     // 0x0000000000cc8800, 0x0000000000fd9800, 0x0000000000ef4800
  55     // }
  56     // _smr_java_thread_list_alloc_cnt=24, _smr_java_thread_list_free_cnt=23, _smr_java_thread_list_max=23, _smr_nested_thread_list_max=0
  57     // _smr_delete_lock_wait_cnt=0, _smr_delete_lock_wait_max=0
  58     // _smr_to_delete_list_cnt=0, _smr_to_delete_list_max=1
  59 
  60     final static String HEADER_STR = "Threads class SMR info:";
  61 
  62     static boolean verbose = false;
  63 
  64     public static void main(String[] args) throws Exception {
  65         if (args.length != 0) {
  66             int arg_i = 0;
  67             if (args[arg_i].equals("-v")) {
  68                 verbose = true;
  69                 arg_i++;
  70             }
  71         }
  72 
  73         ProcessBuilder pb = new ProcessBuilder(JSTACK, PID);
  74         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  75 
  76         if (verbose) {
  77             System.out.println("stdout: " + output.getStdout());
  78         }


  28  *
  29  * @library /test/lib
  30  * @modules java.base/jdk.internal.misc
  31  *          java.management
  32  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+EnableThreadSMRStatistics TestThreadDumpSMRInfo
  33  */
  34 
  35 import jdk.test.lib.process.OutputAnalyzer;
  36 import jdk.test.lib.JDKToolFinder;
  37 
  38 public class TestThreadDumpSMRInfo {
  39     // jstack tends to be closely bound to the VM that we are running
  40     // so use getTestJDKTool() instead of getCompileJDKTool() or even
  41     // getJDKTool() which can fall back to "compile.jdk".
  42     final static String JSTACK = JDKToolFinder.getTestJDKTool("jstack");
  43     final static String PID = "" + ProcessHandle.current().pid();
  44 
  45     // Here's a sample "Threads class SMR info" section:
  46     //
  47     // Threads class SMR info:
  48     // _java_thread_list=0x0000000000ce8da0, length=23, elements={
  49     // 0x000000000043a800, 0x0000000000aee800, 0x0000000000b06800, 0x0000000000b26000,
  50     // 0x0000000000b28800, 0x0000000000b2b000, 0x0000000000b2e000, 0x0000000000b30000,
  51     // 0x0000000000b32800, 0x0000000000b35000, 0x0000000000b3f000, 0x0000000000b41800,
  52     // 0x0000000000b44000, 0x0000000000b46800, 0x0000000000b48800, 0x0000000000b53000,
  53     // 0x0000000000b55800, 0x0000000000b57800, 0x0000000000b5a000, 0x0000000000b5c800,
  54     // 0x0000000000cc8800, 0x0000000000fd9800, 0x0000000000ef4800
  55     // }
  56     // _java_thread_list_alloc_cnt=24, _java_thread_list_free_cnt=23, _java_thread_list_max=23, _nested_thread_list_max=0
  57     // _delete_lock_wait_cnt=0, _delete_lock_wait_max=0
  58     // _to_delete_list_cnt=0, _to_delete_list_max=1
  59 
  60     final static String HEADER_STR = "Threads class SMR info:";
  61 
  62     static boolean verbose = false;
  63 
  64     public static void main(String[] args) throws Exception {
  65         if (args.length != 0) {
  66             int arg_i = 0;
  67             if (args[arg_i].equals("-v")) {
  68                 verbose = true;
  69                 arg_i++;
  70             }
  71         }
  72 
  73         ProcessBuilder pb = new ProcessBuilder(JSTACK, PID);
  74         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  75 
  76         if (verbose) {
  77             System.out.println("stdout: " + output.getStdout());
  78         }
< prev index next >