< prev index next >

test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java

Print this page


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  69         } else {
  70             VMType = null;
  71         }
  72 
  73         List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans();
  74 
  75         GCType = null;
  76 
  77         for (GarbageCollectorMXBean gcMxBean : gcMxBeans) {
  78             switch (gcMxBean.getName()) {
  79                 case "ConcurrentMarkSweep":
  80                     GCType = "-XX:+UseConcMarkSweepGC";
  81                     break;
  82                 case "MarkSweepCompact":
  83                     GCType = "-XX:+UseSerialGC";
  84                     break;
  85                 case "PS Scavenge":
  86                     GCType = "-XX:+UseParallelGC";
  87                     break;
  88                 case "G1 Old Generation":

  89                     GCType = "-XX:+UseG1GC";
  90                     break;
  91             }
  92         }
  93     }
  94 
  95     public static boolean fitsRange(String optionName, BigDecimal number) throws Exception {
  96         JVMOption option;
  97         String minRangeString = null;
  98         String maxRangeString = null;
  99         boolean fits = true;
 100 
 101         if (optionsAsMap == null) {
 102             optionsAsMap = getOptionsWithRangeAsMap();
 103         }
 104 
 105         option = optionsAsMap.get(optionName);
 106         if (option != null) {
 107             minRangeString = option.getMin();
 108             if (minRangeString != null) {


   1 /*
   2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  69         } else {
  70             VMType = null;
  71         }
  72 
  73         List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans();
  74 
  75         GCType = null;
  76 
  77         for (GarbageCollectorMXBean gcMxBean : gcMxBeans) {
  78             switch (gcMxBean.getName()) {
  79                 case "ConcurrentMarkSweep":
  80                     GCType = "-XX:+UseConcMarkSweepGC";
  81                     break;
  82                 case "MarkSweepCompact":
  83                     GCType = "-XX:+UseSerialGC";
  84                     break;
  85                 case "PS Scavenge":
  86                     GCType = "-XX:+UseParallelGC";
  87                     break;
  88                 case "G1 Old Generation":
  89                 case "G1 Full":
  90                     GCType = "-XX:+UseG1GC";
  91                     break;
  92             }
  93         }
  94     }
  95 
  96     public static boolean fitsRange(String optionName, BigDecimal number) throws Exception {
  97         JVMOption option;
  98         String minRangeString = null;
  99         String maxRangeString = null;
 100         boolean fits = true;
 101 
 102         if (optionsAsMap == null) {
 103             optionsAsMap = getOptionsWithRangeAsMap();
 104         }
 105 
 106         option = optionsAsMap.get(optionName);
 107         if (option != null) {
 108             minRangeString = option.getMin();
 109             if (minRangeString != null) {


< prev index next >