3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 21:10:17 +01:00
Paper/nms-patches/MethodProfiler.patch

64 Zeilen
2.0 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/MethodProfiler.java
+++ b/net/minecraft/server/MethodProfiler.java
2017-08-03 15:00:00 +02:00
@@ -13,6 +13,7 @@
public class MethodProfiler {
2015-02-26 23:41:06 +01:00
+ public static final boolean ENABLED = Boolean.getBoolean("enableDebugMethodProfiler"); // CraftBukkit - disable unless specified in JVM arguments
2018-07-15 02:00:00 +02:00
private static final Logger a = LogManager.getLogger();
private final List<String> b = Lists.newArrayList();
private final List<Long> c = Lists.newArrayList();
@@ -41,6 +42,7 @@
}
2018-07-15 02:00:00 +02:00
public void a(int i) {
+ if (!ENABLED) return; // CraftBukkit
if (!this.d) {
this.d = true;
this.f.clear();
@@ -52,6 +54,7 @@
}
2018-12-13 01:00:00 +01:00
public void enter(String s) {
2018-07-15 02:00:00 +02:00
+ if (!ENABLED) return; // CraftBukkit
if (this.d) {
2017-05-14 04:00:00 +02:00
if (!this.e.isEmpty()) {
this.e = this.e + ".";
2018-07-15 02:00:00 +02:00
@@ -64,12 +67,14 @@
2017-08-03 15:00:00 +02:00
}
public void a(Supplier<String> supplier) {
2018-07-15 02:00:00 +02:00
+ if (!ENABLED) return; // CraftBukkit
if (this.d) {
2018-12-13 01:00:00 +01:00
this.enter((String) supplier.get());
2017-08-03 15:00:00 +02:00
}
}
2018-12-13 01:00:00 +01:00
public void exit() {
2018-07-15 02:00:00 +02:00
+ if (!ENABLED) return; // CraftBukkit
if (this.d && !this.c.isEmpty()) {
2018-12-13 01:00:00 +01:00
long i = SystemUtils.getMonotonicNanos();
2018-12-06 00:00:00 +01:00
long j = (Long) this.c.remove(this.c.size() - 1);
2018-07-15 02:00:00 +02:00
@@ -92,6 +97,7 @@
}
2015-02-26 23:41:06 +01:00
public List<MethodProfiler.ProfilerInfo> b(String s) {
2018-07-15 02:00:00 +02:00
+ if (!ENABLED) return Collections.emptyList(); // CraftBukkit
2018-12-06 00:00:00 +01:00
long i = this.f.containsKey("root") ? (Long) this.f.get("root") : 0L;
long j = this.f.containsKey(s) ? (Long) this.f.get(s) : -1L;
2018-07-15 02:00:00 +02:00
ArrayList arraylist = Lists.newArrayList();
@@ -154,11 +160,13 @@
}
2018-12-13 01:00:00 +01:00
public void exitEnter(String s) {
2018-07-15 02:00:00 +02:00
+ if (!ENABLED) return; // CraftBukkit
2018-12-13 01:00:00 +01:00
this.exit();
this.enter(s);
}
2018-07-15 02:00:00 +02:00
public String f() {
+ if (!ENABLED) return "[DISABLED]"; // CraftBukkit
return this.b.isEmpty() ? "[UNKNOWN]" : (String) this.b.get(this.b.size() - 1);
2015-02-26 23:41:06 +01:00
}