mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 14:04:49 +01:00
63 lines
2 KiB
Diff
63 lines
2 KiB
Diff
--- a/net/minecraft/server/MethodProfiler.java
|
|
+++ b/net/minecraft/server/MethodProfiler.java
|
|
@@ -12,6 +12,7 @@
|
|
|
|
public class MethodProfiler {
|
|
|
|
+ public static final boolean ENABLED = Boolean.getBoolean("enableDebugMethodProfiler"); // CraftBukkit - disable unless specified in JVM arguments
|
|
private static final Logger a = LogManager.getLogger();
|
|
private final List<String> b = Lists.newArrayList();
|
|
private final List<Long> c = Lists.newArrayList();
|
|
@@ -40,6 +41,7 @@
|
|
}
|
|
|
|
public void a(int i) {
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
if (!this.d) {
|
|
this.d = true;
|
|
this.f.clear();
|
|
@@ -51,6 +53,7 @@
|
|
}
|
|
|
|
public void enter(String s) {
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
if (this.d) {
|
|
if (!this.e.isEmpty()) {
|
|
this.e = this.e + ".";
|
|
@@ -63,12 +66,14 @@
|
|
}
|
|
|
|
public void a(Supplier<String> supplier) {
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
if (this.d) {
|
|
this.enter((String) supplier.get());
|
|
}
|
|
}
|
|
|
|
public void exit() {
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
if (this.d && !this.c.isEmpty()) {
|
|
long i = SystemUtils.getMonotonicNanos();
|
|
long j = (Long) this.c.remove(this.c.size() - 1);
|
|
@@ -91,6 +96,7 @@
|
|
}
|
|
|
|
public List<MethodProfiler.ProfilerInfo> b(String s) {
|
|
+ if (!ENABLED) return Collections.emptyList(); // CraftBukkit
|
|
long i = this.f.containsKey("root") ? (Long) this.f.get("root") : 0L;
|
|
long j = this.f.containsKey(s) ? (Long) this.f.get(s) : -1L;
|
|
List<MethodProfiler.ProfilerInfo> list = Lists.newArrayList();
|
|
@@ -153,11 +159,13 @@
|
|
}
|
|
|
|
public void exitEnter(String s) {
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
this.exit();
|
|
this.enter(s);
|
|
}
|
|
|
|
public String f() {
|
|
+ if (!ENABLED) return "[DISABLED]"; // CraftBukkit
|
|
return this.b.isEmpty() ? "[UNKNOWN]" : (String) this.b.get(this.b.size() - 1);
|
|
}
|
|
|