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 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
public class MethodProfiler {
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2017-01-19 02:42:35 +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 @@
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
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 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void a(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()) {
|
2017-01-19 02:42:35 +01:00
|
|
|
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) {
|
2017-08-03 15:00:00 +02:00
|
|
|
this.a((String) supplier.get());
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
public void e() {
|
|
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
|
|
if (this.d && !this.c.isEmpty()) {
|
|
|
|
long i = SystemUtils.c();
|
|
|
|
long j = ((Long) this.c.remove(this.c.size() - 1)).longValue();
|
|
|
|
@@ -92,6 +97,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
long i = this.f.containsKey("root") ? ((Long) this.f.get("root")).longValue() : 0L;
|
|
|
|
long j = this.f.containsKey(s) ? ((Long) this.f.get(s)).longValue() : -1L;
|
|
|
|
ArrayList arraylist = Lists.newArrayList();
|
|
|
|
@@ -154,11 +160,13 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void c(String s) {
|
2018-07-15 02:00:00 +02:00
|
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
|
|
this.e();
|
2017-01-19 02:42:35 +01:00
|
|
|
this.a(s);
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
@@ -178,7 +186,7 @@
|
2015-02-26 23:41:06 +01:00
|
|
|
return methodprofiler_profilerinfo.a < this.a ? -1 : (methodprofiler_profilerinfo.a > this.a ? 1 : methodprofiler_profilerinfo.c.compareTo(this.c));
|
|
|
|
}
|
|
|
|
|
|
|
|
- public int compareTo(Object object) {
|
2016-02-29 22:32:46 +01:00
|
|
|
+ public int compareTo(MethodProfiler.ProfilerInfo object) { // CraftBukkit: decompile error
|
2015-02-26 23:41:06 +01:00
|
|
|
return this.a((MethodProfiler.ProfilerInfo) object);
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|