< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetCounter.java

Print this page

        

@@ -33,10 +33,13 @@
 /**
  * A counter that can (only) be {@linkplain #inc() incremented} from within a snippet for gathering
  * snippet specific metrics.
  */
 public final class SnippetCounter implements Comparable<SnippetCounter> {
+
+    public static final SnippetCounter DISABLED_COUNTER = new SnippetCounter(null, "Disabled", "Disabled");
+
     /**
      * A group of related counters.
      */
     public static class Group {
 

@@ -128,21 +131,21 @@
     /**
      * Increments the value of this counter. This method can only be used in a snippet on a
      * compile-time constant {@link SnippetCounter} object.
      */
     public void inc() {
-        if (group != null) {
+        if (getGroup() != null) {
             SnippetCounterNode.increment(this);
         }
     }
 
     /**
      * Increments the value of this counter. This method can only be used in a snippet on a
      * compile-time constant {@link SnippetCounter} object.
      */
     public void add(int increment) {
-        if (group != null) {
+        if (getGroup() != null) {
             SnippetCounterNode.add(this, increment);
         }
     }
 
     /**
< prev index next >