< 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,42 ****
--- 33,45 ----
/**
* 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,148 ****
/**
* 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) {
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) {
SnippetCounterNode.add(this, increment);
}
}
/**
--- 131,151 ----
/**
* 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 (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 (getGroup() != null) {
SnippetCounterNode.add(this, increment);
}
}
/**
< prev index next >