< prev index next >

test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java

Print this page
rev 60811 : imported patch jep387-all.patch
rev 60812 : [mq]: diff1


  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 import jdk.test.lib.process.ProcessTools;
  26 import jdk.test.lib.process.OutputAnalyzer;
  27 import jdk.test.lib.JDKToolFinder;
  28 
  29 /*
  30  * @test
  31  * @summary Test the VM.metaspace command
  32  * @requires vm.gc != "Z" & vm.bits != "32"
  33  * @library /test/lib
  34  * @modules java.base/jdk.internal.misc
  35  *          java.management
  36  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers PrintMetaspaceDcmd with-compressed-class-space








































  37  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:-UseCompressedOops -XX:-UseCompressedClassPointers PrintMetaspaceDcmd without-compressed-class-space
  38  */

  39 /*
  40  * @test
  41  * @summary Test the VM.metaspace command
  42  * @requires vm.gc != "Z" & vm.bits == "32"
  43  * @library /test/lib
  44  * @modules java.base/jdk.internal.misc
  45  *          java.management
  46  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M PrintMetaspaceDcmd without-compressed-class-space
  47  */
  48 
  49 public class PrintMetaspaceDcmd {
  50 
  51     // Run jcmd VM.metaspace against a VM with CompressedClassPointers on.
  52     // The report should detail Non-Class and Class portions separately.
  53     private static void doTheTest(boolean usesCompressedClassSpace) throws Exception {
  54         ProcessBuilder pb = new ProcessBuilder();
  55         OutputAnalyzer output;
  56         // Grab my own PID
  57         String pid = Long.toString(ProcessTools.getProcessId());
  58 
  59         pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.metaspace", "basic"});
  60         output = new OutputAnalyzer(pb.start());
  61         output.shouldHaveExitValue(0);
  62         if (usesCompressedClassSpace) {
  63             output.shouldContain("Non-Class:");
  64             output.shouldContain("Class:");
  65         }
  66         output.shouldContain("Virtual space:");
  67         output.shouldContain("Chunk freelists:");
  68         output.shouldMatch("MaxMetaspaceSize:.*201.00.*MB");
  69 
  70         pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.metaspace"});
  71         output = new OutputAnalyzer(pb.start());
  72         output.shouldHaveExitValue(0);




  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 import jdk.test.lib.process.ProcessTools;
  26 import jdk.test.lib.process.OutputAnalyzer;
  27 import jdk.test.lib.JDKToolFinder;
  28 
  29 /*
  30  * @test id=test-64bit-ccs
  31  * @summary Test the VM.metaspace command
  32  * @requires vm.bits == "64"
  33  * @library /test/lib
  34  * @modules java.base/jdk.internal.misc
  35  *          java.management
  36  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers PrintMetaspaceDcmd with-compressed-class-space
  37  */
  38 
  39 /*
  40  * @test id=test-64bit-ccs-noreclaim
  41  * @summary Test the VM.metaspace command
  42  * @requires vm.bits == "64"
  43  * @library /test/lib
  44  * @modules java.base/jdk.internal.misc
  45  *          java.management
  46  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:MetaspaceReclaimPolicy=none PrintMetaspaceDcmd with-compressed-class-space
  47  */
  48 
  49 /*
  50  * @test id=test-64bit-ccs-aggressivereclaim
  51  * @summary Test the VM.metaspace command
  52  * @requires vm.bits == "64"
  53  * @library /test/lib
  54  * @modules java.base/jdk.internal.misc
  55  *          java.management
  56  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:MetaspaceReclaimPolicy=aggressive PrintMetaspaceDcmd with-compressed-class-space
  57  */
  58 
  59 /*
  60  * @test id=test-64bit-ccs-guarded
  61  * @summary Test the VM.metaspace command
  62  * @requires vm.bits == "64"
  63  * @requires vm.debug == true
  64  * @library /test/lib
  65  * @modules java.base/jdk.internal.misc
  66  *          java.management
  67  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+MetaspaceGuardAllocations PrintMetaspaceDcmd with-compressed-class-space
  68  */
  69 
  70 /*
  71  * @test id=test-64bit-noccs
  72  * @summary Test the VM.metaspace command
  73  * @requires vm.bits == "64"
  74  * @library /test/lib
  75  * @modules java.base/jdk.internal.misc
  76  *          java.management
  77  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:-UseCompressedOops -XX:-UseCompressedClassPointers PrintMetaspaceDcmd without-compressed-class-space
  78  */
  79 
  80 /*
  81  * @test test-32bit
  82  * @summary Test the VM.metaspace command
  83  * @requires vm.bits == "32"
  84  * @library /test/lib
  85  * @modules java.base/jdk.internal.misc
  86  *          java.management
  87  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M PrintMetaspaceDcmd without-compressed-class-space
  88  */
  89 
  90 public class PrintMetaspaceDcmd {
  91 


  92     private static void doTheTest(boolean usesCompressedClassSpace) throws Exception {
  93         ProcessBuilder pb = new ProcessBuilder();
  94         OutputAnalyzer output;
  95         // Grab my own PID
  96         String pid = Long.toString(ProcessTools.getProcessId());
  97 
  98         pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.metaspace", "basic"});
  99         output = new OutputAnalyzer(pb.start());
 100         output.shouldHaveExitValue(0);
 101         if (usesCompressedClassSpace) {
 102             output.shouldContain("Non-Class:");
 103             output.shouldContain("Class:");
 104         }
 105         output.shouldContain("Virtual space:");
 106         output.shouldContain("Chunk freelists:");
 107         output.shouldMatch("MaxMetaspaceSize:.*201.00.*MB");
 108 
 109         pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.metaspace"});
 110         output = new OutputAnalyzer(pb.start());
 111         output.shouldHaveExitValue(0);


< prev index next >