src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalDebugInitializationParticipant.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalDebugInitializationParticipant.java

Print this page




  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  */
  23 package org.graalvm.compiler.core;
  24 
  25 import org.graalvm.compiler.debug.Debug;
  26 import org.graalvm.compiler.debug.Debug.Params;
  27 import org.graalvm.compiler.debug.DebugInitializationParticipant;
  28 import org.graalvm.compiler.debug.GraalDebugConfig;
  29 import org.graalvm.compiler.debug.TTY;
  30 import org.graalvm.compiler.debug.internal.method.MethodMetricsPrinter;

  31 import org.graalvm.compiler.serviceprovider.ServiceProvider;
  32 
  33 /**
  34  * A service provider that may modify the initialization of {@link Debug} based on the values
  35  * specified for various {@link GraalDebugConfig} options.
  36  */
  37 @ServiceProvider(DebugInitializationParticipant.class)
  38 public class GraalDebugInitializationParticipant implements DebugInitializationParticipant {
  39 
  40     @Override
  41     public void apply(Params params) {
  42         if (GraalDebugConfig.areDebugScopePatternsEnabled()) {

  43             params.enable = true;
  44         }
  45         if ("".equals(GraalDebugConfig.Options.Count.getValue())) {
  46             params.enableUnscopedCounters = true;
  47         }
  48         if ("".equals(GraalDebugConfig.Options.MethodMeter.getValue())) {
  49             params.enableUnscopedMethodMetrics = true;
  50             // mm requires full debugging support
  51             params.enable = true;
  52         }
  53         if ("".equals(GraalDebugConfig.Options.Time.getValue())) {
  54             params.enableUnscopedTimers = true;
  55         }
  56         if ("".equals(GraalDebugConfig.Options.TrackMemUse.getValue())) {
  57             params.enableUnscopedMemUseTrackers = true;
  58         }
  59         // unscoped counters/timers/mem use trackers/method metrics should respect method filter
  60         // semantics
  61         if (!params.enable && (params.enableUnscopedMemUseTrackers || params.enableUnscopedMethodMetrics || params.enableUnscopedCounters || params.enableUnscopedTimers) &&
  62                         GraalDebugConfig.isNotEmpty(GraalDebugConfig.Options.MethodFilter)) {
  63             params.enable = true;
  64             params.enableMethodFilter = true;
  65         }
  66 
  67         if (!params.enableUnscopedMethodMetrics && GraalDebugConfig.Options.MethodMeter.getValue() != null) {
  68             // mm requires full debugging support
  69             params.enable = true;
  70         }
  71 
  72         if (GraalDebugConfig.isGlobalMetricsInterceptedByMethodMetricsEnabled()) {
  73             if (!params.enable) {
  74                 TTY.println("WARNING: MethodMeter is disabled but GlobalMetricsInterceptedByMethodMetrics is enabled. Ignoring MethodMeter and GlobalMetricsInterceptedByMethodMetrics.");
  75             } else {
  76                 parseMethodMetricsDebugValueInterception(params);
  77             }
  78         }
  79         if (GraalDebugConfig.isNotEmpty(GraalDebugConfig.Options.MethodMeter) || params.enableUnscopedMethodMetrics) {
  80             if (!MethodMetricsPrinter.methodMetricsDumpingEnabled()) {
  81                 TTY.println("WARNING: MethodMeter is enabled but MethodMeter dumping is disabled. Output will not contain MethodMetrics.");
  82             }
  83         }
  84     }
  85 
  86     private static void parseMethodMetricsDebugValueInterception(Params params) {
  87         String interceptionGroup = GraalDebugConfig.Options.GlobalMetricsInterceptedByMethodMetrics.getValue();
  88         boolean intercepted = false;
  89         if (interceptionGroup.contains("Timers")) {
  90             params.interceptTime = true;
  91             intercepted = true;
  92         }
  93         if (interceptionGroup.contains("Counters")) {
  94             params.interceptCount = true;
  95             intercepted = true;
  96         }
  97         if (interceptionGroup.contains("MemUseTrackers")) {
  98             params.interceptMem = true;
  99             intercepted = true;
 100         }
 101 
 102         if (!intercepted) {
 103             TTY.println("WARNING: Ignoring GlobalMetricsInterceptedByMethodMetrics as the supplied argument does not contain Timers/Counters/MemUseTrackers.");
 104             GraalDebugConfig.Options.GlobalMetricsInterceptedByMethodMetrics.setValue(null);
 105         }
 106     }
 107 }


  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  */
  23 package org.graalvm.compiler.core;
  24 
  25 import org.graalvm.compiler.debug.Debug;
  26 import org.graalvm.compiler.debug.Debug.Params;
  27 import org.graalvm.compiler.debug.DebugInitializationParticipant;
  28 import org.graalvm.compiler.debug.GraalDebugConfig;
  29 import org.graalvm.compiler.debug.TTY;
  30 import org.graalvm.compiler.debug.internal.method.MethodMetricsPrinter;
  31 import org.graalvm.compiler.options.OptionValues;
  32 import org.graalvm.compiler.serviceprovider.ServiceProvider;
  33 
  34 /**
  35  * A service provider that may modify the initialization of {@link Debug} based on the values
  36  * specified for various {@link GraalDebugConfig} options.
  37  */
  38 @ServiceProvider(DebugInitializationParticipant.class)
  39 public class GraalDebugInitializationParticipant implements DebugInitializationParticipant {
  40 
  41     @Override
  42     public void apply(Params params) {
  43         OptionValues options = params.getOptions();
  44         if (GraalDebugConfig.areDebugScopePatternsEnabled(options)) {
  45             params.enable = true;
  46         }
  47         if ("".equals(GraalDebugConfig.Options.Count.getValue(options))) {
  48             params.enableUnscopedCounters = true;
  49         }
  50         if ("".equals(GraalDebugConfig.Options.MethodMeter.getValue(options))) {
  51             params.enableUnscopedMethodMetrics = true;
  52             // mm requires full debugging support
  53             params.enable = true;
  54         }
  55         if ("".equals(GraalDebugConfig.Options.Time.getValue(options))) {
  56             params.enableUnscopedTimers = true;
  57         }
  58         if ("".equals(GraalDebugConfig.Options.TrackMemUse.getValue(options))) {
  59             params.enableUnscopedMemUseTrackers = true;
  60         }
  61         // unscoped counters/timers/mem use trackers/method metrics should respect method filter
  62         // semantics
  63         if (!params.enable && (params.enableUnscopedMemUseTrackers || params.enableUnscopedMethodMetrics || params.enableUnscopedCounters || params.enableUnscopedTimers) &&
  64                         GraalDebugConfig.isNotEmpty(GraalDebugConfig.Options.MethodFilter, options)) {
  65             params.enable = true;
  66             params.enableMethodFilter = true;
  67         }
  68 
  69         if (!params.enableUnscopedMethodMetrics && GraalDebugConfig.Options.MethodMeter.getValue(options) != null) {
  70             // mm requires full debugging support
  71             params.enable = true;
  72         }
  73 
  74         if (GraalDebugConfig.isGlobalMetricsInterceptedByMethodMetricsEnabled(options)) {
  75             if (!params.enable) {
  76                 TTY.println("WARNING: MethodMeter is disabled but GlobalMetricsInterceptedByMethodMetrics is enabled. Ignoring MethodMeter and GlobalMetricsInterceptedByMethodMetrics.");
  77             } else {
  78                 parseMethodMetricsDebugValueInterception(params, options);
  79             }
  80         }
  81         if (GraalDebugConfig.isNotEmpty(GraalDebugConfig.Options.MethodMeter, options) || params.enableUnscopedMethodMetrics) {
  82             if (!MethodMetricsPrinter.methodMetricsDumpingEnabled(options)) {
  83                 TTY.println("WARNING: MethodMeter is enabled but MethodMeter dumping is disabled. Output will not contain MethodMetrics.");
  84             }
  85         }
  86     }
  87 
  88     private static void parseMethodMetricsDebugValueInterception(Params params, OptionValues options) {
  89         String interceptionGroup = GraalDebugConfig.Options.GlobalMetricsInterceptedByMethodMetrics.getValue(options);
  90         boolean intercepted = false;
  91         if (interceptionGroup.contains("Timers")) {
  92             params.interceptTime = true;
  93             intercepted = true;
  94         }
  95         if (interceptionGroup.contains("Counters")) {
  96             params.interceptCount = true;
  97             intercepted = true;
  98         }
  99         if (interceptionGroup.contains("MemUseTrackers")) {
 100             params.interceptMem = true;
 101             intercepted = true;
 102         }
 103 
 104         if (!intercepted) {
 105             TTY.println("WARNING: Ignoring GlobalMetricsInterceptedByMethodMetrics as the supplied argument does not contain Timers/Counters/MemUseTrackers.");

 106         }
 107     }
 108 }
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalDebugInitializationParticipant.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File